change resorce scoping
Tests & Lint & Deploy to Railway / build (20.x, 8.3) (push) Failing after 2m57s Details
Tests & Lint & Deploy to Railway / deploy (push) Has been skipped Details

https://laravel.com/docs/10.x/controllers#restful-scoping-resource-routes
This commit is contained in:
aslan 2024-02-08 18:34:45 +03:00
parent 397f0faf19
commit 2279341988
6 changed files with 11 additions and 6 deletions

View File

@ -20,6 +20,7 @@ git clone http://172.17.254.104/aslan/applicant-site.git
cd applicant-site cd applicant-site
make setup make setup
``` ```
2255
## Project start local ## Project start local

View File

@ -17,7 +17,7 @@ class RouteServiceProvider extends ServiceProvider
* *
* @var string * @var string
*/ */
public const HOME = '/dashboard'; public const HOME = '/admin/dashboard';
/** /**
* Define your route model bindings, pattern filters, and other route configuration. * Define your route model bindings, pattern filters, and other route configuration.

View File

@ -14,6 +14,7 @@ return new class extends Migration
Schema::create('educational_institutions', function (Blueprint $table) { Schema::create('educational_institutions', function (Blueprint $table) {
$table->id(); $table->id();
$table->string('name'); $table->string('name');
$table->string('slug');
$table->text('description'); $table->text('description');
$table->integer('position'); $table->integer('position');
$table->timestamps(); $table->timestamps();

View File

@ -18,12 +18,14 @@ class EducationalInstitutionSeeder extends Seeder
[ [
'name' => 'МГТУ', 'name' => 'МГТУ',
'description' => 'ФГБОУ ВО Майкопский государственный технологический университет', 'description' => 'ФГБОУ ВО Майкопский государственный технологический университет',
'position' => 1 'slug' => 'mkgtu',
'position' => 1,
], ],
[ [
'name' => 'Педколледж', 'name' => 'Педколледж',
'description' => 'ФГБОУ СПО Педагогический колледж', 'description' => 'ФГБОУ СПО Педагогический колледж',
'position' => 1 'slug' => 'pedcollege',
'position' => 1,
], ],
]); ]);
} }

View File

@ -7,15 +7,16 @@ use App\Http\Controllers\FileController;
use App\Http\Controllers\ReceptionScreenController; use App\Http\Controllers\ReceptionScreenController;
use App\Http\Controllers\UserController; use App\Http\Controllers\UserController;
Route::middleware(['auth', 'verified'])->group(function () { Route::middleware(['auth', 'verified'])->prefix('admin')->group(function () {
Route::get('/files/create/{file?}', [FileController::class, 'create'])->name('files_create'); Route::get('/files/create/{file?}', [FileController::class, 'create'])->name('files_create');
Route::get('/files/download/{file}', [FileController::class, 'download'])->name('files.download'); Route::get('/files/download/{file}', [FileController::class, 'download'])->name('files.download');
Route::resource('/educational-institutions', EducationalInstitutionController::class)
->scoped(['educational_institution' => 'slug']);
Route::resources([ Route::resources([
'/files' => FileController::class, '/files' => FileController::class,
'/users' => UserController::class, '/users' => UserController::class,
'/admin-reception-screen' => ReceptionScreenController::class, '/admin-reception-screen' => ReceptionScreenController::class,
'/educational-institutions' => EducationalInstitutionController::class,
'/faculties' => FacultyController::class, '/faculties' => FacultyController::class,
'/departments' => DepartmentController::class, '/departments' => DepartmentController::class,
]); ]);

View File

@ -5,7 +5,7 @@ use Illuminate\Support\Facades\Route;
Route::get('/dashboard', function () { Route::get('/dashboard', function () {
return view('admin'); return view('admin');
})->middleware(['auth', 'verified'])->name('dashboard'); })->prefix('admin')->middleware(['auth', 'verified'])->name('dashboard');
Route::middleware('auth')->group(function () { Route::middleware('auth')->group(function () {
Route::get('/profile', [ProfileController::class, 'edit'])->name('profile.edit'); Route::get('/profile', [ProfileController::class, 'edit'])->name('profile.edit');