Docs Discussion Login Register

Discussion

Start Discussion General Feature Module Dev Theme Dev Installation Hosting

I'm creating a module hower after creating the permissions and make sure that they were check on Admin role, it keeps redirecting me to the dashboard.


Permission:

$group = PermissionFacade::add(
            'carousel',
            function (PermissionGroup $group) {
                $group->label('Banners');
            }
        );


        $group->addPermission(
            'carousel.index',
            function (Permission $permission) {
                $permission->label('carousel List')
                    ->routes('carousel.index');
            }
        );


Routes:

Route::middleware(['web', 'admin.auth'])
    ->prefix($baseAdminUrl)
    ->name('admin.')
    ->group(function () {
        Route::get('carousel', AvoRed\Banner\Http\Controllers\TableController::class)
            ->name('carousel.index');
    });
Pedro Martins 2 months ago

Found the solution when looking to the banners module on github, it seems it needs to have the 'permission' middleware to check the permissions, admin.auth isnt enough


Source:

https://github.com/avored/laravel-ecommerce/issues/422

Purvesh 1 month ago

Yes you are right. I have a custom middleware `permission` to check against the route.


Reply
General Feature Module Dev Theme Dev Installation Hosting Save Cancel

© AvoRed 2020 Privacy