fixed User model
This commit is contained in:
parent
2a2370b3a5
commit
235bc0b405
@ -5,14 +5,15 @@
|
|||||||
use App\Domain\ACL\Permission;
|
use App\Domain\ACL\Permission;
|
||||||
use App\Domain\ACL\Role;
|
use App\Domain\ACL\Role;
|
||||||
use App\Models\Traits\Active;
|
use App\Models\Traits\Active;
|
||||||
|
use App\Models\Traits\HasDepartment;
|
||||||
use App\Models\Traits\HashableId;
|
use App\Models\Traits\HashableId;
|
||||||
|
use App\Models\Traits\HasOrganization;
|
||||||
use App\Services\UserService;
|
use App\Services\UserService;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Database\Factories\UserFactory;
|
use Database\Factories\UserFactory;
|
||||||
use Filament\Models\Contracts\FilamentUser;
|
use Filament\Models\Contracts\FilamentUser;
|
||||||
use Filament\Panel;
|
use Filament\Panel;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
|
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||||
@ -30,6 +31,7 @@ class User extends Authenticatable implements FilamentUser
|
|||||||
{
|
{
|
||||||
use Active;
|
use Active;
|
||||||
use HasApiTokens;
|
use HasApiTokens;
|
||||||
|
use HasDepartment, HasOrganization;
|
||||||
/** @use HasFactory<UserFactory> */
|
/** @use HasFactory<UserFactory> */
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
use HashableId;
|
use HashableId;
|
||||||
@ -40,26 +42,7 @@ class User extends Authenticatable implements FilamentUser
|
|||||||
|
|
||||||
public array $info = [];
|
public array $info = [];
|
||||||
|
|
||||||
/**
|
protected $guarded = ['id'];
|
||||||
* 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',
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that should be hidden for serialization.
|
* The attributes that should be hidden for serialization.
|
||||||
@ -159,16 +142,6 @@ public function radiologistProfile(): HasOne
|
|||||||
return $this->hasOne(RadiologistProfile::class);
|
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
|
public function canAccessPanel(Panel $panel): bool
|
||||||
{
|
{
|
||||||
return $this->isAdmin();
|
return $this->isAdmin();
|
||||||
|
Loading…
Reference in New Issue
Block a user