Skip to content

Instantly share code, notes, and snippets.

@indraAsLesmana
Created January 4, 2025 10:34
Show Gist options
  • Save indraAsLesmana/9ca85235cf0e0074c7bdaec9ec2fd3f3 to your computer and use it in GitHub Desktop.
Save indraAsLesmana/9ca85235cf0e0074c7bdaec9ec2fd3f3 to your computer and use it in GitHub Desktop.
<?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