mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange.git
synced 2026-08-19 20:34:08 +00:00
315ed64520
updated booking controller added test for booking
106 lines
2.0 KiB
PHP
106 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App;
|
|
|
|
use Tymon\JWTAuth\Contracts\JWTSubject;
|
|
use Illuminate\Notifications\Notifiable;
|
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
|
use App\Notifications\ResetPassword as ResetPasswordNotification;
|
|
use Zizaco\Entrust\Traits\EntrustUserTrait;
|
|
|
|
|
|
class User extends Authenticatable implements JWTSubject
|
|
{
|
|
use Notifiable;
|
|
use EntrustUserTrait;
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $fillable = [
|
|
'name', 'email', 'password',
|
|
];
|
|
|
|
/**
|
|
* The attributes that should be hidden for arrays.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $hidden = [
|
|
'password', 'remember_token',
|
|
];
|
|
|
|
/**
|
|
* The accessors to append to the model's array form.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $appends = [
|
|
'photo_url', 'role'
|
|
];
|
|
|
|
/**
|
|
* Get the profile photo URL attribute.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getPhotoUrlAttribute()
|
|
{
|
|
return 'https://www.gravatar.com/avatar/'.md5(strtolower($this->email)).'.jpg?s=200&d=mm';
|
|
}
|
|
|
|
/**
|
|
* Get the role attribute.
|
|
*
|
|
* @return string
|
|
*/
|
|
public function getRoleAttribute()
|
|
{
|
|
// return $this->roles->first()->name;
|
|
}
|
|
|
|
/**
|
|
* Get the oauth providers.
|
|
*
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
*/
|
|
public function oauthProviders()
|
|
{
|
|
return $this->hasMany(OAuthProvider::class);
|
|
}
|
|
|
|
/**
|
|
* Send the password reset notification.
|
|
*
|
|
* @param string $token
|
|
* @return void
|
|
*/
|
|
public function sendPasswordResetNotification($token)
|
|
{
|
|
$this->notify(new ResetPasswordNotification($token));
|
|
}
|
|
|
|
/**
|
|
* @return int
|
|
*/
|
|
public function getJWTIdentifier()
|
|
{
|
|
return $this->getKey();
|
|
}
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
public function getJWTCustomClaims()
|
|
{
|
|
return [];
|
|
}
|
|
|
|
public function booking(){
|
|
return $this->hasMany('App\Booking');
|
|
}
|
|
|
|
}
|