Explain, please, what is the purpose of 'as' and 'uses'. I do not understand the principle of these words.
Route::get('user/profile', array('as' => 'profile', 'uses' => 'UserController@showProfile')); Explain, please, what is the purpose of 'as' and 'uses'. I do not understand the principle of these words.
Route::get('user/profile', array('as' => 'profile', 'uses' => 'UserController@showProfile')); as - works as a prefix to the route, in your case it is better to simply replace as with the name method:
Route::get('user/profile', array('uses' => 'UserController@showProfile'))->name('profile'); If you would leave 'as' => 'profile' and write the name('profile') then in the end route name would be profileprofile .
uses - says which controller to use and method, in your case it is also not necessary, it is easier to do this:
Route::get('user/profile', 'UserController@showProfile')->name('profile'); Easier and clearer.
UPD. About the name method and how to use it is described in the documentation.
Source: https://ru.stackoverflow.com/questions/599881/
All Articles