can't we just define a constructor?
public function __construct()
{
if (blah) {
dd('xxxxxxxxxxx');
}
}
I don't know about that, just asking.
What are you looking for? Do you want your controller to instantiate some data that you need for each method in that controller? You might indeed do that in the constructor.
If you only need some logic to be executed before going to the controller that doesn't really need to be available within the controller itself, I agree with Erik that you'd need to be looking at middleware instead.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community