Question:
How to get the "current Controller" in a view, that is "Processing" the Request respectively triggering/calling the View. (Beside passing an instance to the view via parameter)?
Is there some "current global Context" similar to Request that I can get like Controller::instance() or similiar?
From the Application
$controller = app(\Illuminate\Routing\Route::class)->controller;
And also, there is a nicer way
$controller = request()->route()->controller;
Tested on Laravel 7.29.3
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With