<?php namespace App\Models;
use CodeIgniter\Model;
use App\Entities\Departments;
class DepartmentModel extends Model
{
protected $table = 'department';
protected $primaryKey = 'id';
protected $returnType = 'App\Entities\Departments';
protected $useSoftDeletes = false;
protected $allowedFields = ['naam', 'omschrijving', 'actief'];
protected $useTimestamps = true;
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
protected $deletedField = 'deleted_at';
protected $validationRules = [
'naam' => 'required|min_length[2]|max_length[150]|is_unique[department.naam,id,{id}]',
'omschrijving' => 'max_length[150]',
];
protected $validationMessages = [
'naam'=> [
'min_length' => 'Sorry. Deze naam is reeds al aanwezig. Kies een andere naam.'
]
];
protected $skipValidation = false;
}