2020-06-08 08:04:45 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App;
|
|
|
|
|
|
|
|
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
2020-06-08 13:08:46 +00:00
|
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
2020-06-08 08:04:45 +00:00
|
|
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
|
|
|
use Illuminate\Notifications\Notifiable;
|
2020-06-22 08:08:18 +00:00
|
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
use Illuminate\Support\Facades\Hash;
|
2020-06-08 13:08:46 +00:00
|
|
|
use Spatie\Permission\Traits\HasRoles;
|
2020-06-08 08:04:45 +00:00
|
|
|
|
|
|
|
class User extends Authenticatable
|
|
|
|
{
|
|
|
|
use Notifiable;
|
2020-06-08 13:08:46 +00:00
|
|
|
use HasRoles;
|
2020-06-08 08:04:45 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The attributes that are mass assignable.
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $fillable = [
|
2020-06-30 10:21:05 +00:00
|
|
|
'name_first', "name_last", 'email', 'password', "phone", "roles"
|
2020-06-08 08:04:45 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The attributes that should be hidden for arrays.
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $hidden = [
|
|
|
|
'password', 'remember_token',
|
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The attributes that should be cast to native types.
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $casts = [
|
|
|
|
'email_verified_at' => 'datetime',
|
|
|
|
];
|
2020-06-22 08:08:18 +00:00
|
|
|
|
|
|
|
public function setPasswordAttribute($password) {
|
|
|
|
$this->attributes["password"] = Hash::make($password);
|
|
|
|
}
|
2020-06-08 08:04:45 +00:00
|
|
|
}
|