403 error when accessing filamentPHP admin panel

By: Roel
June 28, 2024

canAccesspanel for v3 instead of canaccessFilament ... also note the different of imported Classess

V3:


<?php
 
namespace App\Models;
 
use Filament\Models\Contracts\FilamentUser;
use Filament\Panel;
use Illuminate\Foundation\Auth\User as Authenticatable;
 
class User extends Authenticatable implements FilamentUser
{
    // ...
 
    public function canAccessPanel(Panel $panel): bool
    {
        return str_ends_with($this->email, '@yourdomain.com') && $this->hasVerifiedEmail();
    }
}

V2:

<?php
 
namespace App\Models;
 
use Filament\Models\Contracts\FilamentUser;
use Illuminate\Foundation\Auth\User as Authenticatable;
 
class User extends Authenticatable implements FilamentUser
{
    // ...
 
    public function canAccessFilament(): bool
    {
        return str_ends_with($this->email, '@yourdomain.com') && $this->hasVerifiedEmail();
    }
}
Tags:

About the Author

Roel
Roel

Hi, my name is Roel. I am a TALL stack developer. I created this site to document all web applications I created using the TALL stack. I exclusively built products using Laravel because I like the experience writing applications using the simplest framework/stack available.



Please login to comment.

© 2024 Talldevelopers.com, All rights reserved.