In the Laravel route there are 2 ways:
- Direct load view file from the route, No need to go to controller.
- Go to the Controller and perform the operation then load the view file.
1 2 3 | Route::get('/', function () { return view('welcome'); }); |
Here you can see the ‘resources/views/welcome.blade.php’ file load directly.
1 2 | Route::match(['get', 'post'], 'product', 'ProductController@index'); Route::match(['get', 'post'], 'product/{id}', 'ProductController@detail'); |
url route to method of controller.
‘product/{id}’ : url with parameter
‘ProductController@detail’ : ProductController is controller and detail is method