add CRM module start

This commit is contained in:
root
2026-01-15 07:09:36 +03:00
parent b14f293a45
commit b810a17649
40 changed files with 3807 additions and 14 deletions
+52
View File
@@ -0,0 +1,52 @@
<?php
namespace App\Modules\CRM\Entities;
use CodeIgniter\Entity\Entity;
class Contact extends Entity
{
protected $attributes = [
'id' => 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;
}
}