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

65 lines
1.1 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
*/
protected $table = 'users';
/**
2025-04-03 09:30:16 +02:00
* @var string
*/
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
*/
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');
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
}