mirror of
https://gitlab.com/omair-personal/exchange.git
synced 2026-08-19 20:44:13 +00:00
4a4e147072
fix UserBankSlip class not found fix undefined book_id added loading when confirm booking added confirm booking success redirect with correct page added error handling for upload user bankslip completed upload user bankslip flow
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(Booking::class);
|
|
}
|
|
|
|
}
|