/
home
/
pay
/
server_old
/
app
/
Models
/
File Upload :
llllll
Current File: /home/pay/server_old/app/Models/Customer.php
<?php namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Support\Facades\Hash; use Rooyesh\Wallet\models\Wallet; use Illuminate\Foundation\Auth\User as Authenticatable; use Tymon\JWTAuth\Contracts\JWTSubject; class Customer extends Authenticatable implements JWTSubject { use HasFactory,SoftDeletes,Selector; protected $fillable = [ 'fname', 'lname', 'name', 'active', 'finger_print', 'mobile', 'email', 'avatar_id', 'last_seen_at', 'default_address_id', 'sts', 'total_transaction', 'token_sms', 'password', 'orders_count', 'birth_date', 'shop_name', 'phone_number', 'code', 'city', 'province', 'n_code', 'is_archive', 'gram', 'trade_active',//آیا امکان معامله دارد؟ 'type', 'referral_id', 'referral_to_id', 'credential_id', ]; /** * The attributes that should be hidden for arrays. * * @var array */ protected $hidden = [ 'password', 'token_sms', ]; /** * The attributes that should be cast to native types. * * @var array */ protected $casts = [ "active" => "boolean", "is_archive" => "boolean", "finger_print" => "boolean", ]; static $TYPE = [ 1=>'همکار', 2=>'خانگی', 3=>'سرمایه گذار' ]; static $TYPES = [ 1=>'همکار', 2=>'خانگی', 3=>'سرمایه گذار' ]; public function setNameAttribute($name = null){ $this->attributes['name'] = $name??[$this->attributes['fname'] , $this->attributes['lname']].join(' '); } public function wallet() { return $this->hasMany(Wallet::class ,'owner')->with('fund')->select(['cash', 'fund_id','gold', 'owner']); } public function user() { return $this->belongsTo(User::class)->select(['id','name']); } public function referral() { return $this->belongsTo(Customer::class, 'referral_to_id', 'referral_id'); } // hash password public function setPasswordAttribute($value){ $this->attributes['password'] = Hash::make($value); } public function getJWTIdentifier() { return $this->getKey(); } public function getJWTCustomClaims() { return []; } }
Copyright ©2k19 -
Hexid
|
Tex7ure