60 lines
1.4 KiB
PHP
60 lines
1.4 KiB
PHP
<?php namespace App\Models;
|
|
|
|
use CodeIgniter\Model;
|
|
|
|
class PartnerPosModel extends Model
|
|
{
|
|
|
|
protected $table = 'partner_pos';
|
|
|
|
protected $primaryKey = 'id';
|
|
|
|
protected $returnType = 'array'; // Can be 'array' or 'object' (e.g., \App\Entities\PartnerPos)
|
|
|
|
protected $useAutoIncrement = true;
|
|
|
|
protected $useTimestamps = true;
|
|
|
|
protected $createdField = 'created_on';
|
|
|
|
protected $updatedField = 'updated_on';
|
|
|
|
protected $allowedFields = [
|
|
'name',
|
|
'email',
|
|
'mobile',
|
|
'pos_code',
|
|
'certificate_file_name',
|
|
'aadhar',
|
|
'pan',
|
|
'is_active',
|
|
'created_by',
|
|
'updated_by',
|
|
'manager_id',
|
|
];
|
|
|
|
protected $validationRules = [
|
|
'name' => 'required|min_length[3]',
|
|
'email' => 'permit_empty|valid_email|is_unique[partner_pos.email,id,{id}]',
|
|
'mobile' => 'permit_empty|numeric|max_length[20]|is_unique[partner_pos.mobile,id,{id}]',
|
|
'manager_id' => 'required|integer',
|
|
];
|
|
|
|
protected $validationMessages = [
|
|
'email' => [
|
|
'is_unique' => 'Sorry, that email address is already registered.',
|
|
],
|
|
];
|
|
|
|
/**
|
|
* @var bool Whether to skip validation during inserts and updates.
|
|
*/
|
|
protected $skipValidation = false;
|
|
|
|
/**
|
|
* @var bool Whether to clean data for SQL Injection.
|
|
*/
|
|
protected $cleanValidationRules = true;
|
|
|
|
|
|
} |