芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/rentandbuyrealty.com/rentandbuyrealty.com/app/Models/Customer.php
*/ protected $fillable = [ 'name', 'email', 'firebase_id', 'mobile', 'profile', 'address', 'fcm_id', 'logintype', 'isActive', ]; protected $hidden = [ 'api_token' ]; protected $appends = [ 'customertotalpost' ]; /** * Get the identifier that will be stored in the subject claim of the JWT. * * @return mixed */ public function getJWTIdentifier() { return $this->getKey(); } /** * Return a key value array, containing any custom claims to be added to the JWT. * * @return array */ public function getJWTCustomClaims() { return [ 'customer_id' => $this->id ]; } public function user_purchased_package() { return $this->morphMany(UserPurchasedPackage::class, 'modal'); } public function getCustomerTotalPostAttribute() { return Property::where('added_by', $this->id)->get()->count(); } public function favourite() { return $this->hasMany(Favourite::class, 'user_id'); } public function property() { return $this->hasMany(Property::class, 'added_by'); } public function getProfileAttribute($image) { // Check if $image is a valid URL if (filter_var($image, FILTER_VALIDATE_URL)) { return $image; // If $image is already a URL, return it as it is } else { // If $image is not a URL, construct the URL using configurations return $image != '' ? url('') . config('global.IMG_PATH') . config('global.USER_IMG_PATH') . $image : ''; } } public function usertokens() { return $this->hasMany(Usertokens::class, 'customer_id'); } }