I hope someone can help here :) I have an app where I would manage some University courses hence I have different routes as such:
domain/courses -> which would hit CourseController method index - for students
domain/admin/courses -> which should hit Admin/CoutseController method index - for admins
Below is how I got started defining the routes for Admins
Route::prefix('admin')->name('admin.')->group(function ()
{
Route::resource('/users', UserController::class)->middleware(['auth', 'isAdmin']);
Route::resource('/levels', LevelController::class)->middleware(['auth', 'isAdmin']);
});
But I don't get how to bind different Controllers that use the same names to specific routes :( (CourseController to answer domain/courses and Admin/CourseController to answer for domain/admin/courses).
From Larravel documentation I understood that I have to use the namespace method with my routes so that grouped routes are bind to the specific namespace however I get a binding error:
Illuminate\Contracts\Container\BindingResolutionException
Target class [Admin\App\Http\Controllers\Admin\UserController] does not exist.