Laravel:在非对象上调用成员函数getParameter()

时间:2015-06-29 16:15:15

标签: php parameters request laravel-5

在AppServiceProvider中,我想将对象设置为IoC容器,如:

$organisation = OrganisationHelper::getOrganisationBySlug();
$this->app->instance('Organisation', $organisation);

Inside OrganisationHelper我有以下代码:

$slug = \App::make('request')->route()->getParameter('organisation');
return Organisation::select('id', 'name', 'slug')->where('slug', '=', $slug)->first();

我得到的错误是: 在非对象

上调用成员函数getParameter()

可能是因为路由器尚未发送,但我不知道如何解决此问题或以其他任何方式获取路由参数。

有关如何解决路线的任何建议吗?

0 个答案:

没有答案