If the child classes do not implement their own constructor the parent constructor will still be called.
You only need to manually call the parent constructor if the child class needs its own constructor.
Ok, I found a workaround for my problem... But there's another problem:
Isn't it possible to Redirect in parent classes? Tried to do:
class ProjectBaseController {
public function __construct() {
if(true) {
return Redirect::to('somewhere');
}
}
}
class ProjectController extends ProjectBaseController {
public function showSomething() {
dd('foo'); // should never been displayed, since parent class redirects us
}
}
But the redirect isn't working :(
Using a filter in the parent class solved my problem.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community