I'm using Laravel 8 and I wanted to use the old way of calling controller and routes in web.php
.
So instead of saying this:
Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');
I would call the Controller like this:
Route::get('/home', 'HomeController@index')->name('home');
So I added this to AppServiceProvider.php
:
public function boot()
{
Route::prefix('web')
->middleware('web')
->namespace('App\Http\Controllers') // <---------
->group(base_path('routes/web.php'));
}
But it doesn't seem to be working because I'm getting this error:
Target class [HomeController] does not exist.
So how can I call my Controller at web.php
like the old style which was used in Laravel 5 versions?
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2Z6dOBF
via IFTTT
Aucun commentaire:
Enregistrer un commentaire