Laravel-Backpack / PermissionManager

Admin interface for managing users, roles, permissions, using Backpack CRUD
http://backpackforlaravel.com
Other
516 stars 166 forks source link

Auth guard [] is not defined. #312

Closed webdevb closed 1 year ago

webdevb commented 1 year ago

Bug report

What I did:

Hello, I have recently install backpack on a fresh installation of laravel and everything was going well until I have installed the PermissionManager plugin and now I can't seem to access the dashboard, I keep getting the following error: Auth guard [] is not defined. within the file: CheckIfAdmin.php

I've added auth to the /home route like so:

Route::get('/home', function () {
   return view('welcome');
})->middleware(['auth']);

Which seems to work fine.

What I expected to happen:

To be able to access the dashboard.

Backpack, Laravel, PHP, DB version:

Backpack CRUD: 5.4.3 Backpack Permission Manager: 6.0.15 PHP: 8.0.23 DB: MySQL 8.0.30

welcome[bot] commented 1 year ago

Hello there! Thanks for opening your first issue on this repo!

Just a heads-up: Here at Backpack we use Github Issues only for tracking bugs. Talk about new features is also acceptable. This helps a lot in keeping our focus on improving Backpack. If you issue is not a bug/feature, please help us out by closing the issue yourself and posting in the appropriate medium (see below). If you're not sure where it fits, it's ok, a community member will probably reply to help you with that.

Backpack communication mediums:

Please keep in mind Backpack offers no official / paid support. Whatever help you receive here, on Gitter, Slack or Stackoverflow is thanks to our awesome awesome community members, who give up some of their time to help their peers. If you want to join our community, just start pitching in. We take pride in being a welcoming bunch.

Thank you!

-- Justin Case The Backpack Robot

webdevb commented 1 year ago

Ah, so I've managed to get a little further now.

If I change 'guard' => null to 'guard' => "backpack" I can get past the error, looking at the logs it was erroring on:

@if (backpack_auth()->check())
    {{-- Topbar. Contains the left part --}}
    @include(backpack_view('inc.topbar_left_content'))
@endif

Within the menu.blade.php file.

I do now have another issue when I try and access the roles I get the following error:'Undefined array key "guard_name"

pxpm commented 1 year ago

Hello @webdevb

Sorry it took sometime to get into this.

Backpack already provides a /dashboard url. You may enable or disable it's configuration in config/backpack/base.php.

Also please make sure you followed the permission manager installation carefully.

Also note that auth middlware is not the same as config('backpack.base.middleware_key', 'admin') that represents the backpack auth middleware.

If nothing of what I said helps, can you please share the your User model, and the database dump for roles table ?

Cheers

pxpm commented 1 year ago

Closing due to inactivity, please re-open if needed!

Cheers