ldc-mesbr-app/app/Models/User.php

69 lines
1.2 KiB
PHP
Raw Permalink Normal View History

2019-01-15 14:17:15 +01:00
<?php
namespace App\Models;
2019-01-15 14:17:15 +01:00
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use App\Models\Notifications\ResetPassword;
2019-01-15 14:17:15 +01:00
class User extends Authenticatable
{
use Notifiable;
2019-02-13 16:37:14 +01:00
/**
* @var string
*/
const CREATED_AT = 'created_at';
/**
* @var string
*/
const UPDATED_AT = 'updated_at';
/**
* @var string
*/
2026-10-28 13:23:49 +01:00
2019-02-13 16:37:14 +01:00
protected $table = 'users';
/**
2025-04-03 09:30:16 +02:00
* @var string
*/
2026-10-28 13:23:49 +01:00
2019-02-13 16:37:14 +01:00
protected $primaryKey = 'id';
2021-04-27 17:29:47 +02:00
2019-01-15 14:17:15 +01:00
/**
* The attributes that are mass assignable.
*
* @var array
*/
2026-10-28 13:23:49 +01:00
2019-01-15 14:17:15 +01:00
protected $fillable = [
'name', 'email', 'password', 'roles',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
2026-10-28 13:23:49 +01:00
2019-01-15 14:17:15 +01:00
protected $hidden = [
'password', 'remember_token',
];
/**
* The sites that belong to the user.
*/
public function sites()
{
2026-10-28 12:27:46 +01:00
return $this->belongsToMany(\App\Models\Site::class, 'site_user', 'user_id', 'site_id');
2019-01-15 14:17:15 +01:00
}
2019-02-26 11:32:45 +01:00
public function sendPasswordResetNotification($token)
{
2021-04-27 17:29:47 +02:00
$this->notify(new ResetPassword($token));
2019-02-26 11:32:45 +01:00
}
2019-01-15 14:17:15 +01:00
}