Add order to routes
composer require giuga/laravel-ordered-routes
Find
$app = new \Illuminate\Foundation\Application(
realpath(__DIR__.'/../')
);
Replace with
$app = new \Giuga\Application(
realpath(__DIR__.'/../')
);
Find
'aliases' => [
...
'Route' => Illuminate\Support\Facades\Route::class,
...
Replace with
'aliases' => [
...
'Route' => Giuga\Routing\Facades\OrderRoute::class,
...
By using this package you have the ability to define routes in what ever order you want.
In the example below the {slug?} would catch also the home route even if this was not our intention. By defining an order, if the requested url matches a predefined route like /home and /home does not have a higher order number than {slug?} home will be used.
Route:get('{slug?}', function($slug){ return $slug; } )->name('named.slug')->order(999);
Route:get('/home'), function(){ return 'This is my Home'; })->name('home');