97 lines
1.7 KiB
PHP
97 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
|
use Illuminate\Notifications\Notifiable;
|
|
|
|
class Customer extends Authenticatable
|
|
{
|
|
use Notifiable;
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $fillable = [
|
|
'crm_id',
|
|
'civility',
|
|
'firstname',
|
|
'lastname',
|
|
'birth_date',
|
|
'email',
|
|
'password',
|
|
'address',
|
|
'address2',
|
|
'town',
|
|
'postal_code',
|
|
'country',
|
|
'email_verify_token',
|
|
'email_verified'
|
|
];
|
|
|
|
/**
|
|
* 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' => 'boolean',
|
|
'email_verified_at' => 'datetime',
|
|
];
|
|
|
|
/**
|
|
* Map attribute names to enum classes.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $enumCasts = [
|
|
'role' => UserRole::class
|
|
];
|
|
|
|
// * RELATIONSHIPS
|
|
|
|
/**
|
|
* Has Many Participation relation
|
|
*
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
*/
|
|
public function participations()
|
|
{
|
|
return $this->hasMany(Participation::class, 'customer_id');
|
|
}
|
|
|
|
// * METHODS
|
|
|
|
/**
|
|
* Check if user is admin.
|
|
* ! Not local CRM !
|
|
*
|
|
* @return boolean
|
|
*/
|
|
public function isAdmin(): bool
|
|
{
|
|
return false;
|
|
}
|
|
|
|
/**
|
|
* Check if user is local.
|
|
* ! Not local CRM !
|
|
*
|
|
* @return boolean
|
|
*/
|
|
public function isLocal(): bool
|
|
{
|
|
return false;
|
|
}
|
|
}
|