Using "get()" Method
So instead of using the "get()" method below.
Route::get('/pages/contact-us', function () { return view('pages.contact-us'); });
You can use the "view()" method like below.
Using "view()" Method
Route::view('/pages/contact-us', 'pages.contact-us');
By using this way the code is more expressive and straightforward. Do note that if you need to pass parameters then you can pass in as the 3rd parameter.
Route::view('/pages/contact-us', 'pages.contact-us', ['email' => '[email protected]']);
Leave a reply