|
|
@@ -3,13 +3,16 @@
|
|
|
namespace App\Models;
|
|
|
|
|
|
use App\Enums\LanguageEnum;
|
|
|
+use App\Enums\UserStatusEnum;
|
|
|
use App\Enums\UserTypeEnum;
|
|
|
use App\Traits\HasPermissions;
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
+use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
+use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
|
+use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
|
|
use Illuminate\Notifications\Notifiable;
|
|
|
use Laravel\Sanctum\HasApiTokens;
|
|
|
-use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
|
use Carbon\Carbon;
|
|
|
|
|
|
/**
|
|
|
@@ -65,9 +68,12 @@ class User extends Authenticatable
|
|
|
{
|
|
|
return [
|
|
|
"email_verified_at" => "datetime",
|
|
|
- "password" => "hashed",
|
|
|
- "type" => UserTypeEnum::class,
|
|
|
- "language" => LanguageEnum::class,
|
|
|
+ "password" => "hashed",
|
|
|
+ "type" => UserTypeEnum::class,
|
|
|
+ "language" => LanguageEnum::class,
|
|
|
+ "status" => UserStatusEnum::class,
|
|
|
+ "admission_date" => "date",
|
|
|
+ "expiry_date" => "date",
|
|
|
];
|
|
|
}
|
|
|
|
|
|
@@ -120,6 +126,36 @@ class User extends Authenticatable
|
|
|
->delete();
|
|
|
}
|
|
|
|
|
|
+ public function position(): BelongsTo
|
|
|
+ {
|
|
|
+ return $this->belongsTo(Position::class);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function sector(): BelongsTo
|
|
|
+ {
|
|
|
+ return $this->belongsTo(Sector::class);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function dependents(): HasMany
|
|
|
+ {
|
|
|
+ return $this->hasMany(UserDependent::class, 'responsible_user_id');
|
|
|
+ }
|
|
|
+
|
|
|
+ public function appointments(): HasMany
|
|
|
+ {
|
|
|
+ return $this->hasMany(Appointment::class);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function notificationSends(): HasMany
|
|
|
+ {
|
|
|
+ return $this->hasMany(NotificationSend::class);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function storeItemInterests(): HasMany
|
|
|
+ {
|
|
|
+ return $this->hasMany(StoreItemInterest::class);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @return BelongsToMany
|
|
|
*/
|