router->bind('server', function ($value) use ($request) { try { return Container::getInstance()->make(ServerRepositoryInterface::class)->findFirstWhere([ ['uuidShort', '=', $value], ]); } catch (RecordNotFoundException $ex) { $request->attributes->set('is_missing_model', true); return null; } }); $this->router->bind('database', function ($value) use ($request) { try { $id = Container::getInstance()->make(HashidsInterface::class)->decodeFirst($value); return Container::getInstance()->make(DatabaseRepositoryInterface::class)->findFirstWhere([ ['id', '=', $id], ]); } catch (RecordNotFoundException $exception) { $request->attributes->set('is_missing_model', true); return null; } }); return parent::handle($request, $next); } }