php - Problems with Laravel Controller class
Solution:
Everything seems to be fine with your code. Confirm with a directory of the controller must be
app\Http\Controllers\Admin
Or make changings
$this->routes(function () {
Route::middleware('web')
->namespace('App\Http\Controllers')
->group(base_path('routes/web.php'));
without using getting namespace value here as a variable in RouteServiceProvider.php.
Answer
Solution:
If you are using Laravel 8, it's best to use the new route syntax like so:
use App\Http\Controllers\Admin\PlanController;
Route::get('/admin/plans', [PlanController::class, 'index'])->name('plans.index');
Make sure the controller is in the correct directory app/Http/Controllers/Admin
Answer
Solution:
You can describe the full namespace in your route;
Route::get('admin/plans','App\Http\Controllers\Admin\PlanController@index')->name('plans.index');
Source