Simple route with arrow function


You can use laravel arrow function in routing, without having to use anonymous function. 

 To do this, you can use fn() => arrow function

// Instead of
Route::get('/route_name', function () {
return User::all();
});

// You can
Route::get('/route_name', fn () =>User::all());

No comments:

Post a Comment

Other post

1) The create() Method The  create()  method is a powerful and convenient way to store data in your Laravel application. It is typically use...