Created
January 4, 2025 10:34
-
-
Save indraAsLesmana/9ca85235cf0e0074c7bdaec9ec2fd3f3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Models; | |
// use Illuminate\Contracts\Auth\MustVerifyEmail; | |
use Illuminate\Database\Eloquent\Factories\HasFactory; | |
use Illuminate\Foundation\Auth\User as Authenticatable; | |
use Illuminate\Notifications\Notifiable; | |
use Laravel\Sanctum\HasApiTokens; | |
use Filament\Models\Contracts\FilamentUser; | |
use Filament\Panel; | |
class User extends Authenticatable implements FilamentUser | |
{ | |
/** @use HasFactory<\Database\Factories\UserFactory> */ | |
use HasFactory, HasApiTokens, Notifiable; | |
/** | |
* The attributes that are mass assignable. | |
* | |
* @var list<string> | |
*/ | |
protected $fillable = [ | |
'name', | |
'email', | |
'password', | |
'google_id', | |
'avatar', | |
'email_verified_at', | |
'is_admin' | |
]; | |
/** | |
* The attributes that should be hidden for serialization. | |
* | |
* @var list<string> | |
*/ | |
protected $hidden = [ | |
'password', | |
'remember_token', | |
]; | |
/** | |
* Get the attributes that should be cast. | |
* | |
* @return array<string, string> | |
*/ | |
protected function casts(): array | |
{ | |
return [ | |
'email_verified_at' => 'datetime', | |
'password' => 'hashed', | |
]; | |
} | |
public function canAccessPanel(Panel $panel): bool | |
{ | |
return $this->is_admin; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment