[ 'source' => 'number' ] ]; } public function scopeFilter(Builder $query, array $filters) { $query->when($filters['search'] ?? false, function ($query, $search) { return $query ->where('name', 'iLIKE', '%' . $search . '%') ->orWhere('phone', 'LIKE', '%' . $search . '%'); }); } public function locations() { return $this->belongsTo(Location::class, 'location_id', 'id'); } public function customerGroup() { return $this->belongsTo(CustomerGroup::class, 'customer_group_id', 'id'); } // public function proffiling() // { // return $this->hasMany(FittingOrderCustomer::class); // } public function user() { return $this->belongsTo(User::class); } // public function chat() // { // return $this->hasMany(Chat::class); // } // public function profillings() // { // return $this->hasMany(Profilling::class); // } // public function clubMembers() // { // return $this->hasMany(ClubMember::class, 'customer_id', 'id'); // } public function getPointAttribute() { return $this->hasMany(CustomerPoint::class)->sum("point"); } public function routeNotificationForEmail() { $email = $this->email; return $email; } }