Support the ongoing development of Laravel.io →
Security Architecture

Hello,

in the __construct method of my Controller I added a line to check the ability ofr the user to access the Controller. I'm using the Authorization features of Laravel (https://laravel.com/docs/5.2/authorization) with the Gate facade, example :

function __construct()
    {
        if (Gate::denies('access-users')) {
            abort(403);
        }
}

Everything works fine except with the php artisan route:list which prints the following error :

$ php artisan route:list
                                                          
[Symfony\Component\HttpKernel\Exception\HttpException] 

Is other a way to bypass Authorization when using Artisan ?

thanks

Last updated 2 years ago.
0

I'm confuse with this too

0
    // check if request not from cli
    if ('cli' != php_sapi_name()) {
        $this->authorize('is_admin');
    }

from a console is 'cli'...

0

Sign in to participate in this thread!

Eventy

Your banner here too?

maxime maxime Joined 11 Jan 2016

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.