SWEET1S / moonshine-roles-permissions

RBAC (Role-Based Access Control) in Laravel Moonshine Admin Panel
MIT License
18 stars 3 forks source link

Error in README.md #1

Closed Sozdy closed 1 year ago

Sozdy commented 1 year ago
7. In the AuthServiceProvider.php file, add the following ( Super Admin Role ):

use Illuminate\Support\Facades\Gate;

public function boot()
{
    Gate::before(function ($user, $ability) {
        return $user?->role?->id === 1;
    });
}

Line error: return $user?->role?->id === 1; With this option, all users whose role?->id !== 1will be denied access

Correct option: return $user?->role?->id === 1 ? true : null;

SWEET1S commented 1 year ago

Yes, you are absolutely right, I corrected the error. Thank you so much for writing.