How to pass more than one Can middleware on laravel?

0

Hello, I need to pass several defines to a route, for example admin, annual plan, and new-user, when I put can in the middleware it only identifies the first parameter.

AuthServiceProvider.php

Gate::define("new-user","App\Policies\ACLChecker@checkerNewUser");
        Gate::define("plano-anual","App\Policies\ACLChecker@checkerPlanoAnual");
Gate::define("admin","App\Policies\ACLChecker@checkerAdmin");

web.php

Route::get('/home', 'HomeController@index')->middleware("can:plano-anual,new-user,admin");

Debug:

Gate::after(function ($user, $ability, $result, $arguments) {
            //
            dd($user->plano, $ability, $result, $arguments);

        });
    
asked by anonymous 11.10.2018 / 23:20

0 answers