mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/unity.git
synced 2026-08-19 04:13:58 +00:00
55 lines
1.2 KiB
PHP
55 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Http\Helpers\Hasher;
|
|
use App\Http\Helpers\ImageHandel;
|
|
|
|
use Laravel\Passport\HasApiTokens;
|
|
use Spatie\Permission\Traits\HasRoles;
|
|
|
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
|
use Illuminate\Notifications\Notifiable;
|
|
use Carbon\Carbon;
|
|
|
|
class User extends Authenticatable
|
|
{
|
|
use HasApiTokens, HasRoles, Notifiable;
|
|
|
|
protected $guard_name = 'user';
|
|
|
|
protected $table = 'users';
|
|
|
|
protected $fillable = [
|
|
'name', 'email', 'password',
|
|
];
|
|
|
|
protected $hidden = [
|
|
'password',
|
|
];
|
|
|
|
protected $appends = ['hash_id'];
|
|
|
|
public function getHashIdAttribute()
|
|
{
|
|
return Hasher::encode('users', $this->id);
|
|
}
|
|
|
|
public function getImgAttribute($value)
|
|
{
|
|
$file_info = [];
|
|
$file_info = ImageHandel::getImgFullPath($value, 'person');
|
|
return $file_info;
|
|
}
|
|
|
|
public function getUpdatedAtAttribute($date)
|
|
{
|
|
return $date ? Carbon::parse($date)->timezone('Asia/Kuala_Lumpur')->format('Y-m-d') : '';
|
|
}
|
|
|
|
public function getCreatedAtAttribute($date)
|
|
{
|
|
return $date ? Carbon::parse($date)->timezone('Asia/Kuala_Lumpur')->format('Y-m-d') : '';
|
|
}
|
|
}
|