2020-06-08 08:04:45 +00:00
|
|
|
<?php
|
|
|
|
|
2020-07-27 08:43:22 +00:00
|
|
|
//The Model to a certain Controller, should contain a class with Controller name to which it belongs.
|
|
|
|
// Allows needed strings to passed onto the database. if there is none. class should appear empty.
|
|
|
|
|
|
|
|
//Reference to where the file belongs.
|
2020-06-08 08:04:45 +00:00
|
|
|
namespace App;
|
|
|
|
|
2020-07-27 08:43:22 +00:00
|
|
|
//allows the use of many libraries.
|
2020-06-08 08:04:45 +00:00
|
|
|
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 11:30:01 +00:00
|
|
|
'name_first', "name_last", 'email', 'password', "phone"
|
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
|
|
|
}
|