Laravel 5 : [Call to a member function getAction() on a non-object

前提是你 提交于 2019-12-02 01:12:46

Seems obvious doesn't it?

Get current route in a browser will return the currently visited route. In the terminal you do not have such a request. Laravel will return null when asking what route is visited. You would have to check for the return value before calling getAction.

You can use this code...

if(!App::runningInConsole()){
    Route::getCurrentRoute()->getAction()['as'];
}

when you run artisan command it will not get an error.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!