mirror of
https://git.meshkee.com/cssd/cssd-back.git
synced 2026-10-11 02:01:05 +03:30
90 lines
1.9 KiB
PHP
90 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App;
|
|
|
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
|
use Illuminate\Notifications\Notifiable;
|
|
use Laravel\Passport\HasApiTokens;
|
|
use Spatie\Permission\Traits\HasRoles;
|
|
|
|
class User extends Authenticatable
|
|
{
|
|
use Notifiable , HasApiTokens , HasRoles;
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $fillable = [
|
|
'name' , 'email' , 'password' , 'status' , 'medical_center_id' , 'address' , 'gender'
|
|
];
|
|
/**
|
|
* 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' ,
|
|
];
|
|
|
|
public function medical_center()
|
|
{
|
|
return $this->belongsTo( 'App\MedicalCenter' );
|
|
}
|
|
|
|
public function test_results()
|
|
{
|
|
return $this->hasMany( 'App\TestResult' );
|
|
}
|
|
|
|
public function test_types()
|
|
{
|
|
return $this->hasMany( 'App\TestType' );
|
|
}
|
|
|
|
public function findForPassport( $username )
|
|
{
|
|
return $this->where( 'cell_number' , $username )->where( 'status' , 'Active' )->first();
|
|
}
|
|
|
|
public function messagesSent()
|
|
{
|
|
return $this->hasMany( 'App\Message' , 'sender_user_id' );
|
|
}
|
|
|
|
public function messagesReceived()
|
|
{
|
|
return $this->hasMany( 'App\Message' , 'recipient_user_id' );
|
|
}
|
|
|
|
public function packages()
|
|
{
|
|
return $this->hasMany( 'App\Package' );
|
|
}
|
|
|
|
public function items()
|
|
{
|
|
return $this->hasMany( 'App\Item' );
|
|
}
|
|
|
|
public function labels()
|
|
{
|
|
return $this->hasMany( 'App\Label' );
|
|
}
|
|
|
|
public function cycles()
|
|
{
|
|
return $this->hasMany( 'App\Cycle' );
|
|
}
|
|
}
|