php - Laravel: Call to a member function getParameter() on a non-object -
in appserviceprovider want set object ioc container like:
$organisation = organisationhelper::getorganisationbyslug(); $this->app->instance('organisation', $organisation);
inside organisationhelper have following code:
$slug = \app::make('request')->route()->getparameter('organisation'); return organisation::select('id', 'name', 'slug')->where('slug', '=', $slug)->first();
the error i'm getting is: call member function getparameter() on non-object
it's because router has not been dispatched yet, don't know how fix or route parameter in other way.
any suggestions on how resolve route here?
Comments
Post a Comment