laravel routing summary
Aug 23, 2020
PHP
Beginner
Laravel
#What is routing Role that connects the URL requested from view and the Action defined in Controller The mechanism that calls the action of the corresponding Controller according to the accessed address is called Routing
#Basic way of writing Routing
Route::get('user/news/create','user\NewsController@create');
A URL starting with http://XXXXXX.jp/user/ will be specified. Meaning that when you access the URL user/news/create, it will be assigned to the create action of NewsController
#Routing into a group
If you use Route::group in the routing settings, you can collectively define Mainly used ・Prefix (used when putting together URLs) ・Middleware (used mainly for authentication) It’s
The code below is Routing using the same URL via the prefix is grouped together so that it is easy for anyone to see and can handle changes easily.
Route::group(['prefix' =>'user'], function() {
Route::get('news/create','user\NewsController@create');
Route::get('news/edit','user\NewsController@edit');
});