jeudi 23 juin 2016

Adding Laravel middleware depending on environment

I want to add the \Clockwork\Support\Laravel\ClockworkMiddleware::class middleware to $middleware in App\Http\Kernel, but only if the app environment is local.

Is there a better way to do this than extending the App\Http\Kernel constructor?

public function __construct(Application $app, Router $router)
{
    if ($this->app->environment('local')) {
        $this->pushMiddleware(\Clockwork\Support\Laravel\ClockworkMiddleware::class);
    }

    parent::__construct($app, $router);
}



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/290wOmG
via IFTTT

Aucun commentaire:

Enregistrer un commentaire