null, 'organization_id' => null, 'customer_id' => null, 'name' => null, 'email' => null, 'phone' => null, 'position' => null, 'is_primary' => false, 'notes' => null, 'created_at' => null, 'updated_at' => null, 'deleted_at' => null, ]; protected $casts = [ 'id' => 'integer', 'organization_id' => 'integer', 'customer_id' => 'integer', 'name' => 'string', 'email' => 'string', 'phone' => 'string', 'position' => 'string', 'is_primary' => 'boolean', 'notes' => 'string', ]; /** * Получить связанного клиента */ public function getCustomer() { return model(\App\Modules\Clients\Models\ClientModel::class)->find($this->customer_id); } /** * Получить имя клиента */ public function getCustomerName(): ?string { $customer = $this->getCustomer(); return $customer ? $customer->name : null; } }