laravel 8 route action code example
Example 1: set route name laravel
Route::get('/novanoticia', 'HomeController@getNovaNoticia')->name('route_name');
Route::get('/novanoticia', ['as' => 'route_name', 'uses' => 'HomeController@getNovaNoticia']);
Example 2: laraval routing
use App\Http\Controllers\UserController;
use App\Models\User;
// Route definition...
Route::get('/users/{user}', [UserController::class, 'show']);
// Controller method definition...
public function show(User $user)
{
return view('user.profile', ['user' => $user]);
}