belongsTo(Carrier::class); } public function equipment(): HasMany { return $this->hasMany(ClientCarrierEquipment::class, ['carrier_id','client_id'], ['id','client_id']); } public function contacts(): HasMany { return $this->hasMany(ClientCarrierContact::class, 'carrier_id', 'id'); } public function bookings(): HasMany { return $this->hasMany(Booking::class, 'carrier_id', 'id') ->where('client_id', $this->client_id); } public function equipmentTypes(): Attribute { return new Attribute(get: fn() => Equipment::whereIn('id', $this->equipment->pluck('equipment_id'))->get()); } public function equipmentTotal(): Attribute { return new Attribute(get: fn() => $this->equipment->sum('quantity')); } public function dotNumber(): Attribute { return new Attribute(get: fn() => $this->carrier->dot_number); } public function mcNumber(): Attribute { return new Attribute(get: fn() => $this->carrier->mc_number); } public function preferredLanes() { return $this->hasMany(ClientCarrierPreferredLane::class, 'client_carrier_id'); } public function availableTrucks(): HasMany { return $this->hasMany(ClientCarrierAvailableTrucks::class, 'client_carrier_id', 'id'); } }