Gitamin\Providers\RouteServiceProvider::registerBindings PHP Méthode

registerBindings() protected méthode

Register model bindings.
protected registerBindings ( ) : void
Résultat void
    protected function registerBindings()
    {
        $this->app->router->model('owner', Owner::class, function ($slug) {
            return Owner::where('slug', $slug)->firstOrFail();
        });
        $this->app->router->bind('project', function ($slug, $route) {
            $owner = $route->getParameter('owner');
            return Project::where(['owner_id' => $owner->id, 'slug' => $slug])->firstOrFail();
        });
        $this->app->router->bind('issue', function ($iid, $route) {
            $project = $route->getParameter('project');
            return Issue::where(['project_id' => $project->id, 'iid' => $iid])->firstOrFail();
        });
    }