adds roles

This commit is contained in:
2026-02-16 11:19:06 +01:00
parent ebaeb1722d
commit 4dc64c22cb
29 changed files with 495 additions and 89 deletions

View File

@@ -5,6 +5,7 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
@@ -23,6 +24,12 @@ final class User extends Authenticatable
'name',
'email',
'password',
'azure_id',
'photo',
'job_title',
'department',
'phone',
'role_id',
];
/**
@@ -33,6 +40,7 @@ final class User extends Authenticatable
protected $hidden = [
'password',
'remember_token',
'azure_id',
];
/**
@@ -45,9 +53,18 @@ protected function casts(): array
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
'role_id' => 'integer',
];
}
/**
* Get the role assigned to this user.
*/
public function role(): BelongsTo
{
return $this->belongsTo(Role::class);
}
/**
* Get all sessions for this user.
*/