Support the ongoing development of Laravel.io →
Configuration Requests Architecture
Last updated 2 years ago.
0

Upon first pass, I thought the same thing. Then I remembered how inheritance works. Effectively, when you inherit from a class, you get the parents properties and methods automatically. However, when you override these properties or methods you are providing your own manual implementation. The exception being you can explicitly call parent.

So, in your case, you have two options:

  1. If the FlightController constructor is exactly the same as DashboardController, then don't override __construct in FlightController and it will work as expected as it will automatically use __construct in DashboardController.
  2. If you need to perform additional logic in the FlightController constructor you can use parent::__constructor() to invoke the DashboardController constructor so you don't need to repeat/copy its logic (i.e. middleware).
Last updated 8 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.