/** * Define the route model bindings, pattern filters, etc. * * @param \Illuminate\Routing\Router $router * * @return void */ public function boot(Router $router) { parent::boot($router); $router->bind('analysis', function ($value) { $decoded = Hashids::connection('analyses')->decode($value); if (isset($decoded[0]) && is_numeric($decoded[0]) && ($analysis = Analysis::find($decoded[0]))) { return $analysis; } throw new NotFoundHttpException('Analysis not found.'); }); $router->bind('repo', function ($value) { if (is_numeric($value) && ($repo = Repo::find($value))) { return $repo; } throw new NotFoundHttpException('Repo not found.'); }); }