PhoneNumberCast::class, ]; public function clients(): BelongsToMany { return $this->belongsToMany(Client::class); } public function invoices(): Builder { return Invoice::whereIn('client_id', $this->clients()->pluck('clients.id')); } }