Laravel - How to redirect to login if user is not authenticated

后端 未结 4 1845
悲&欢浪女
悲&欢浪女 2021-02-13 19:26

I\'m trying to use the __constructor from the extended class (AdminController extends AdminBaseController) but aparently it\'s not working

4条回答
  •  北荒
    北荒 (楼主)
    2021-02-13 20:08

    The way you extends and execute the parent constrictor is right, however returning a view to execute it is only possible from routes, controller actions and filters. Otherwise you have to call send().

    for you purpose I think you should use before for filter http://laravel.com/docs/4.2/routing#route-filters

提交回复
热议问题