fixed User model

This commit is contained in:
Masroor Ehsan 2025-01-29 09:37:15 +06:00
parent 2a2370b3a5
commit 235bc0b405

View File

@ -5,14 +5,15 @@
use App\Domain\ACL\Permission;
use App\Domain\ACL\Role;
use App\Models\Traits\Active;
use App\Models\Traits\HasDepartment;
use App\Models\Traits\HashableId;
use App\Models\Traits\HasOrganization;
use App\Services\UserService;
use Carbon\Carbon;
use Database\Factories\UserFactory;
use Filament\Models\Contracts\FilamentUser;
use Filament\Panel;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
use Illuminate\Database\Eloquent\Relations\HasOne;
@ -30,6 +31,7 @@ class User extends Authenticatable implements FilamentUser
{
use Active;
use HasApiTokens;
use HasDepartment, HasOrganization;
/** @use HasFactory<UserFactory> */
use HasFactory;
use HashableId;
@ -40,26 +42,7 @@ class User extends Authenticatable implements FilamentUser
public array $info = [];
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'is_active',
'first_name',
'last_name',
'display_name',
'username',
'email',
'phone',
'site_id',
'facility_id',
'profile_photo_path',
'timezone',
'last_seen_at',
'password',
];
protected $guarded = ['id'];
/**
* The attributes that should be hidden for serialization.
@ -159,16 +142,6 @@ public function radiologistProfile(): HasOne
return $this->hasOne(RadiologistProfile::class);
}
public function institute(): BelongsTo
{
return $this->belongsTo(Organization::class);
}
public function facility(): BelongsTo
{
return $this->belongsTo(Department::class);
}
public function canAccessPanel(Panel $panel): bool
{
return $this->isAdmin();