I would like to be able to override the routes defined in app/Http/routes.php with a route in a package.
For example, in app/Http/routes.php I might have this:
Route::get('/search/{type?}',['as' => 'search','uses' => 'SearchController@search']);
I want to be able to define this in /vendor/author/package/src/Http/routes.php:
Route::get('/search/properties', ['as' => 'properties','uses' => 'PropertyController@search']);
The app/Http/routes.php file is loaded first so the route in their is used, not the package.
In Laravel 4 I would do this using App::before or App::after, giving them a priority.
Like so in the package routes:
App::before(function() {
Route::get('/search/properties', ['as' => 'properties','uses' => 'PropertyController@search']);
});
I don't know how to achieve this in Laravel 5. I found this https://mattstauffer.co/blog/laravel-5.0-middleware-filter-style, but don't know how to use that to do what I want.
Edit: The Laravel 4 way of doing this would allow this priority to be set per route, so I'm not just loading all of the package routes before the app.