ldc-jeusselin/app/Models/User.php

74 lines
1.7 KiB
PHP
Raw Permalink Normal View History

2021-02-11 11:24:44 +01:00
<?php
namespace App\Models;
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;
use Illuminate\Auth\Notifications\ResetPassword as ResetPasswordNotification;
2021-02-11 11:24:44 +01:00
use Illuminate\Notifications\Notifiable;
use Illuminate\Support\Facades\Hash;
2021-02-11 11:24:44 +01: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 = [
'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
];
/**
* The attributes that should be cast.
2021-02-11 11:24:44 +01:00
*
* @var array
2021-02-11 11:24:44 +01:00
*/
protected $casts = [
'last_connection' => 'datetime',
'role' => UserRoleEnum::class
2021-02-11 11:24:44 +01:00
];
/**
* The attributes that should be hidden for arrays.
2021-02-11 11:24:44 +01:00
*
* @var array<string>
2021-02-11 11:24:44 +01:00
*/
protected $hidden = [
'remember_token',
'role' => UserRoleEnum::class,
2021-02-11 11:24:44 +01: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
}