<Snippet />

Laravel: Routes besser ausrichten


// Services provider
public function boot()
{
  Route::macro('build', function() {
    return $this;
  });
}

// before - routes/web.php
Route::prefix('/hello')
  -> get('/world', function() {
    return 'hello world';
  })
  ->name('hello.world');


// after
Route::build()
  ->prefix('/hello')
  ->name('hello.world')
  ->get('/world', function() {
    return 'hello world';
  });