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

前端 未结 2 1171
自闭症患者
自闭症患者 2021-01-22 20:14

In my Controller, I have

Route::getCurrentRoute()->getAction()[\'as\']

Everything works well in the browser but as soon as I type



        
2条回答
  •  生来不讨喜
    2021-01-22 20:35

    You can use this code...

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

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

提交回复
热议问题