I just inherited a laravel application and need to migrate it from 4 to 5. Everything is good after following the guide except the filters.php file.
The guide says to move them to the boot method of RouteServiceProvider
and replace before filter with middleware
but it just won't work. I am new to laravel and not sure how everything works.
This is one of the filters i am trying to migrate:
Route::filter('campaign.edit', function($route)
{
$campaign_id = $route->getParameter('id');
if (is_null(Namespace\Campaign::find($campaign_id))) {
if (Input::get('campaign_id')) {
$campaign_id = Input::get('campaign_id');
} else if (Input::get('track_id')) {
$track_id = Input::get('track_id');
$track = Namespace\Track::find($track_id);
$campaign_id = $track->campaign_id;
} else {
return;
}
}
if (false === Auth::user()->canEditCampaign($campaign_id)) {
return App::abort(403);
}
});
How can I go about migrating this piece?