Files
cssd-back/app/User.php
T
2019-04-22 02:17:52 +04:30

59 lines
1.3 KiB
PHP

<?php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
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 medicalcenter()
{
return $this->belongsTo('App\MedicalCenter');
}
public function testresults()
{
return $this->hasMany('App\TestResult');
}
public function testtypes()
{
return $this->hasMany('App\TestType');
}
public function findForPassport($username)
{
return $this->where('cell_number', $username)->first();
}
}