Support the ongoing development of →
posted 10 years ago
Last updated 1 year ago.

I just did a quick test and it really looks like the execution flow is like

  • __construct() in child class/YourController.php
  • execute any action inside __construct() in child class/YourController.php
  • __construct() in parent class/BaseController.php
  • execute the beforeFilter from __construct() in parent class/BaseController.php
  • execute method in YourController.php given by route e.g. getIndex()

So the beforeFilter gets executed after the child constructor.

Don't know if this behaviour is implied.

Maybe someone with more knowledge of the inner workings in Laravel can say something to this.

Last updated 1 year ago.

Sign in to participate in this thread!


Your banner here too?


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.