2021-02-11 11:24:44 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
2023-08-21 15:24:32 +02:00
|
|
|
use App\Enums\UserRoleEnum;
|
|
|
|
|
use Illuminate\Auth\Passwords\CanResetPassword;
|
2021-02-11 11:24:44 +01:00
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
2023-08-21 15:24:32 +02:00
|
|
|
use Illuminate\Auth\Notifications\ResetPassword as ResetPasswordNotification;
|
2021-02-11 11:24:44 +01:00
|
|
|
use Illuminate\Notifications\Notifiable;
|
2023-08-21 15:24:32 +02:00
|
|
|
use Illuminate\Support\Facades\Hash;
|
2021-02-11 11:24:44 +01:00
|
|
|
|
2023-08-21 15:24:32 +02:00
|
|
|
/**
|
|
|
|
|
* @property string $hashcode
|
|
|
|
|
* @property string $firstname
|
|
|
|
|
* @property string $lastname
|
|
|
|
|
* @property string $email
|
|
|
|
|
* @property string $password
|
|
|
|
|
* @property string $password_token
|
|
|
|
|
* @property \App\Enums\UserRoleEnum $role
|
|
|
|
|
* @property string $remember_token
|
|
|
|
|
* @property \Carbon\Carbon $created_at
|
|
|
|
|
* @property \Carbon\Carbon $updated_at
|
|
|
|
|
*
|
|
|
|
|
* @package App\Models
|
|
|
|
|
*/
|
2021-02-11 11:24:44 +01:00
|
|
|
class User extends Authenticatable
|
|
|
|
|
{
|
2023-08-16 15:27:22 +02:00
|
|
|
use HasFactory;
|
|
|
|
|
use Notifiable;
|
2021-04-02 13:30:11 +02:00
|
|
|
|
2021-02-11 11:24:44 +01:00
|
|
|
/**
|
|
|
|
|
* The attributes that are mass assignable.
|
|
|
|
|
*
|
|
|
|
|
* @var array
|
|
|
|
|
*/
|
|
|
|
|
protected $fillable = [
|
2021-02-16 20:37:53 +01:00
|
|
|
'firstname',
|
|
|
|
|
'lastname',
|
2021-02-11 11:24:44 +01:00
|
|
|
'email',
|
2023-08-16 15:27:22 +02:00
|
|
|
'role'
|
2021-02-11 11:24:44 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
|
|
/**
|
2026-03-19 11:21:49 +01:00
|
|
|
* The attributes that should be cast.
|
2021-02-11 11:24:44 +01:00
|
|
|
*
|
2026-03-19 11:21:49 +01:00
|
|
|
* @var array
|
2021-02-11 11:24:44 +01:00
|
|
|
*/
|
2026-03-19 11:21:49 +01:00
|
|
|
protected $casts = [
|
|
|
|
|
'last_connection' => 'datetime',
|
|
|
|
|
'role' => UserRoleEnum::class
|
2021-02-11 11:24:44 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
|
|
/**
|
2026-03-19 11:21:49 +01:00
|
|
|
* The attributes that should be hidden for arrays.
|
2021-02-11 11:24:44 +01:00
|
|
|
*
|
2026-03-19 11:21:49 +01:00
|
|
|
* @var array<string>
|
2021-02-11 11:24:44 +01:00
|
|
|
*/
|
2026-03-19 11:21:49 +01:00
|
|
|
protected $hidden = [
|
|
|
|
|
'remember_token',
|
|
|
|
|
'role' => UserRoleEnum::class,
|
2021-02-11 11:24:44 +01:00
|
|
|
];
|
2023-08-21 15:24:32 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Perform any actions required after the model boots.
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
protected static function booted()
|
|
|
|
|
{
|
|
|
|
|
// * EVENT CLOSURES.
|
|
|
|
|
}
|
2021-02-11 11:24:44 +01:00
|
|
|
}
|