This commit is contained in:
f4ilji
2024-11-21 00:25:35 +05:00
parent bdd6fdeb62
commit 1efd49607f
6 changed files with 391 additions and 3 deletions
+6 -2
View File
@@ -12,12 +12,14 @@ use Filament\Tables\Columns\Layout\Panel;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Fortify\TwoFactorAuthenticatable;
use Laravel\Sanctum\HasApiTokens;
use Spatie\Permission\Traits\HasRoles;
use Vormkracht10\TwoFactorAuth\Enums\TwoFactorType;
class User extends Authenticatable implements FilamentUser
{
use HasApiTokens, HasFactory, Notifiable, HasRoles, HasPanelShield;
use HasApiTokens, HasFactory, Notifiable, HasRoles, HasPanelShield, TwoFactorAuthenticatable;
/**
* The attributes that are mass assignable.
@@ -28,7 +30,8 @@ class User extends Authenticatable implements FilamentUser
'name',
'email',
'password',
'slug'
'slug',
'two_factor_type'
];
/**
@@ -49,6 +52,7 @@ class User extends Authenticatable implements FilamentUser
protected $casts = [
'email_verified_at' => 'datetime',
'password' => 'hashed',
'two_factor_type' => TwoFactorType::class,
];
public function userDetail()
+9
View File
@@ -8,6 +8,9 @@ use Illuminate\Auth\Events\Registered;
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Event;
use Laravel\Fortify\Events\TwoFactorAuthenticationChallenged;
use Laravel\Fortify\Events\TwoFactorAuthenticationEnabled;
use Vormkracht10\TwoFactorAuth\Listeners\SendTwoFactorCodeListener;
class EventServiceProvider extends ServiceProvider
{
@@ -20,6 +23,12 @@ class EventServiceProvider extends ServiceProvider
Registered::class => [
SendEmailVerificationNotification::class,
],
TwoFactorAuthenticationChallenged::class => [
SendTwoFactorCodeListener::class,
],
TwoFactorAuthenticationEnabled::class => [
SendTwoFactorCodeListener::class,
],
];
/**
@@ -20,6 +20,7 @@ use Illuminate\Session\Middleware\AuthenticateSession;
use Illuminate\Session\Middleware\StartSession;
use Illuminate\View\Middleware\ShareErrorsFromSession;
use ShuvroRoy\FilamentSpatieLaravelBackup\FilamentSpatieLaravelBackupPlugin;
use Vormkracht10\TwoFactorAuth\TwoFactorAuthPlugin;
class AdminPanelProvider extends PanelProvider
@@ -64,6 +65,7 @@ class AdminPanelProvider extends PanelProvider
\BezhanSalleh\FilamentShield\FilamentShieldPlugin::make(),
FilamentSpatieLaravelBackupPlugin::make()->usingPage(Backups::class),
CheckpointPlugin::make(),
TwoFactorAuthPlugin::make()->forced(),
]);
}
}