douyi3676 2017-06-18 15:42
浏览 105
已采纳

在加载页面之前,在每个页面上调用Laravel方法

I'm looking for a way to call a method and do a specific action before a page is loaded on every routes, and every method called on my project.

Except with View composers, is there any way to achieve this ? In my case I don't need to share any data to the view, it's just about instantiating a session value depending on some cases in my project.

Thanks.

  • 写回答

1条回答 默认 最新

  • douzuo0002 2017-06-18 15:45
    关注

    You can just try middlewares for achieving this. You can all middlewares in each route.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?