ldc-mesbr-app/app/Models/User.php
2026-10-28 13:23:49 +01:00

68 lines
1.2 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use App\Models\Notifications\ResetPassword;
class User extends Authenticatable
{
use Notifiable;
/**
* @var string
*/
const CREATED_AT = 'created_at';
/**
* @var string
*/
const UPDATED_AT = 'updated_at';
/**
* @var string
*/
protected $table = 'users';
/**
* @var string
*/
protected $primaryKey = 'id';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'password', 'roles',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
/**
* The sites that belong to the user.
*/
public function sites()
{
return $this->belongsToMany(\App\Models\Site::class, 'site_user', 'user_id', 'site_id');
}
public function sendPasswordResetNotification($token)
{
$this->notify(new ResetPassword($token));
}
}