Yes you can use an array, but that is instead of chaining
Route::get('/', array(
'uses' => 'HomeController@index',
'name' => 'home'
));
Your own syntax would not work as that would just mean that calling / would call all controllers
Hi, laravel community please I want to create an array of the route get... in this moment I have this
Route::get('/home', 'HomeController@index')->name('home');
Route::get('/advantages', 'advantages@index')->name('advantages');
Route::get('/features', 'features@index')->name('features');
Route::get('/statics', 'statics@index')->name('statics');
Route::get('/about', 'about@index')->name('about');
Route::get('/preorder', 'preorder@index')->name('preorder');
But I read on a post that you can have some kind of array like :
Route::get('/', array(
'home' => 'HomeController@index', // NEED NAME PARAMETER HERE
'advantages' => 'CalendarController@showCalendar' // NEED NAME PARAMETER HERE
SOMEONE CAN HELP ME, THANKS A LOT
I don't think so. The closest thing you can do is to use resource to group routes for a controller (get, put, post and delete)
https://laravel.com/docs/6.x/controllers#resource-controllers
Please or to participate in this conversation.