vendredi 31 août 2018

Get Laravel 5 controller name in boot method

I have some theme in laravel that boot via this in my Custom package

 $this->app->makeWith( $themeClass, [ $this->app ] )

How I can get current controller name? I need this for know if this page is post or product and get id this product

in view works fine this code

            $routeArray = app( 'request' )->route()->getAction();
            $controllerAction = class_basename( $routeArray['controller'] );

but in theme not works

Call to a member function getAction() on null

I use laravel 5.6



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2LEdMnS
via IFTTT

Aucun commentaire:

Enregistrer un commentaire