This commit is contained in:
@@ -3,9 +3,12 @@
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
use App\Models\Concerns\SchoolYearAutoFillTrait;
|
||||
|
||||
class PromotionQueueModel extends Model
|
||||
{
|
||||
use SchoolYearAutoFillTrait;
|
||||
|
||||
protected $table = 'promotion_queue';
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
@@ -20,7 +23,12 @@ class PromotionQueueModel extends Model
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'updated_by',
|
||||
'school_year',
|
||||
];
|
||||
protected $validationRules = [
|
||||
'school_year' => 'required|string|max_length[9]',
|
||||
];
|
||||
|
||||
|
||||
protected $useTimestamps = true;
|
||||
protected $createdField = 'created_at';
|
||||
@@ -32,6 +40,8 @@ class PromotionQueueModel extends Model
|
||||
return false;
|
||||
}
|
||||
|
||||
$data['school_year'] = (string)($data['school_year'] ?? $data['school_year_from'] ?? $data['school_year_to']);
|
||||
|
||||
$existing = $this->where('student_id', (int)$data['student_id'])
|
||||
->where('school_year_to', (string)$data['school_year_to'])
|
||||
->first();
|
||||
@@ -43,4 +53,3 @@ class PromotionQueueModel extends Model
|
||||
return (bool) $this->insert($data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user