64 lines
1.1 KiB
PHP
64 lines
1.1 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', 'site_user', 'user_id', 'site_id');
|
|
}
|
|
|
|
|
|
public function sendPasswordResetNotification($token)
|
|
{
|
|
$this->notify(new ResetPassword($token));
|
|
}
|
|
}
|