LaravelTest
30 строк · 1.6 Кб
1<?php
2
3
4use Illuminate\Support\Facades\Route;
5use App\Http\Controllers\UsersController;
6use App\Http\Controllers\ProfileController;
7use App\Http\Controllers\CategoryController;
8use App\Http\Controllers\MainController;
9
10Route::get('/', [MainController::class, 'index'])->name('admin');
11
12Route::prefix('categories')->group(function() {
13Route::get('/', [CategoryController::class, 'index'])->name('categories.index');
14Route::get('/create', [CategoryController::class, 'create'])->name('categories.create');
15Route::post('/', [CategoryController::class,'store'])->name('categories.store');
16Route::get('/{category}', [CategoryController::class,'show'])->name('categories.show');
17Route::get('/{category}/edit', [CategoryController::class, 'edit'])->name('categories.edit');
18Route::put('/{category}', [CategoryController::class, 'update'])->name('categories.update');
19Route::delete('/{category}', [CategoryController::class, 'destroy'])->name('categories.destroy');
20});
21
22Route::prefix('users')->group(function() {
23Route::get('/', [UsersController::class, 'index'])->name('users.index');
24Route::get('/create', [UsersController::class, 'create'])->name('users.create');
25Route::post('/', [UsersController::class,'store'])->name('users.store');
26Route::get('/{user}', [UsersController::class,'show'])->name('users.show');
27Route::get('/{user}/edit', [UsersController::class, 'edit'])->name('users.edit');
28Route::put('/{user}', [UsersController::class, 'update'])->name('users.update');
29Route::delete('/{user}', [UsersController::class, 'destroy'])->name('users.destroy');
30});