|
Server : Apache/2.4.41 (Ubuntu) System : Linux vmi1525618.contaboserver.net 5.4.0-105-generic #119-Ubuntu SMP Mon Mar 7 18:49:24 UTC 2022 x86_64 User : www-data ( 33) PHP Version : 8.2.12 Disable Function : NONE Directory : /var/www/flavourapps.com/leads/leads/app/Models/ |
Upload File : |
<?php
namespace App\Models;
use Laravel\Sanctum\HasApiTokens;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use App\Traits\HasPermissionsTrait;
class User extends Authenticatable
{
use HasApiTokens, HasFactory, Notifiable, HasPermissionsTrait;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
"admin_id",
"name",
"email",
"mobile",
"password",
"gender",
"id_type",
"id_number",
"organization",
"organization_id",
"designation",
"department",
"address",
"city",
"state",
"pincode",
"country",
"vehicle_type_id",
"vehicle_number",
"vehicle_model",
"profile_pics",
"type",
"status",
"branch_limit"
];
/**
* 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 = [
'created_at' => 'datetime:Y-m-d H:i:s',
'updated_at' => 'datetime:Y-m-d H:i:s',
];
public function identity()
{
return $this->hasOne(Identity::class,'id','id_type');
}
public function company()
{
return $this->hasOne(Company::class,'id','organization_id');
}
public function state_name()
{
return $this->hasOne(State::class,'id','state');
}
public function country_name()
{
return $this->hasOne(Country::class,'id','country');
}
public function vehicle()
{
return $this->hasOne(Vehicle::class,'id','vehicle_type_id');
}
}