Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- Route::middleware(['auth'])->name('backend.')->prefix('admin')->group(function () {
- Route::get('/dashboard', [AdminController::class, 'dashboard']);
- Route::controller(UserController::class)->group(function () {
- Route::get('/users', 'index');
- Route::get('/users/{id}', 'show');
- });
- Route::resource('posts', [PostController::class, 'index']);
- });
- // User Routes
- // App\Http\Controllers\User\ProfileController
- // namespace use for get controller from folder
- Route::namespace('User')->group(function () {
- Route::get('/user/profile', [ProfileController::class, 'show']);
- Route::get('/user/settings', [SettingsController::class, 'edit']);
- });
- // missing user then redirect to another page handle
- Route::get('/users/{user}', [UsersController::class, 'show'])->missing(function (Request $request) {
- return Redirect::route('users.index');
- });
- // Allows soft-deleted posts to be retrieved
- Route::get('/posts/{post}', function (Post $post) {
- return $post;
- })->withTrashed();
- Route::middleware(['role:' . User::ROLE_SUPER_ADMIN])->group(function () {
- // Company
- Route::get('company/list/select2', [App\Http\Controllers\Backend\CompanyController::class, 'select2'])->name('company.select2');
- Route::resource('company', App\Http\Controllers\Backend\CompanyController::class);
- });
Advertisement
Add Comment
Please, Sign In to add comment