You can use php arrow function in routing, without having to use anonymous function.
To do this, you can use fn() =>
, it looks easier.
1// Instead of2Route::get('/example', function () {3 return User::all();4});5 6// You can7Route::get('/example', fn () => User::all());