Files
presensi/app/Modules/Notification/Models/StudentParentModel.php
2026-03-05 14:37:36 +07:00

56 lines
1.6 KiB
PHP

<?php
namespace App\Modules\Notification\Models;
use App\Modules\Notification\Entities\StudentParent;
use CodeIgniter\Model;
/**
* Student Parent Model
*
* Handles database operations for student-parent relationships.
*/
class StudentParentModel extends Model
{
protected $table = 'student_parents';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
protected $returnType = StudentParent::class;
protected $useSoftDeletes = false;
protected $protectFields = true;
protected $allowedFields = [
'student_id',
'parent_id',
'relationship',
];
// Dates
protected $useTimestamps = true;
protected $dateFormat = 'datetime';
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
protected $deletedField = 'deleted_at';
// Validation
protected $validationRules = [
'student_id' => 'required|integer|is_not_unique[students.id]',
'parent_id' => 'required|integer|is_not_unique[parents.id]',
'relationship' => 'required|in_list[AYAH,IBU,WALI]',
];
protected $validationMessages = [];
protected $skipValidation = false;
protected $cleanValidationRules = true;
// Callbacks
protected $allowCallbacks = true;
protected $beforeInsert = [];
protected $afterInsert = [];
protected $beforeUpdate = [];
protected $afterUpdate = [];
protected $beforeFind = [];
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
}