ria/app/Models/FactoryMachineModel.php

43 lines
1.2 KiB
PHP

<?php
namespace App\Models;
use CodeIgniter\Model;
class FactoryMachineModel extends Model
{
// The table associated with this model
protected $table = 't_factoryMachineMaster';
// Primary key of the table
protected $primaryKey = 'id';
// Return type (you can use 'array' or 'object')
protected $returnType = 'array';
// Fields that are allowed to be inserted or updated
protected $allowedFields = ['machine_name', 'machine_type', 'energy_type', 'is_active', 'created_at', 'updated_at'];
// Enable automatic timestamps
protected $useTimestamps = true;
// Define custom timestamps columns, if necessary (optional)
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
// Validation rules (optional)
protected $validationRules = [
'machine_name' => 'required|max_length[255]',
'machine_type' => 'required|max_length[255]',
'energy_type' => 'required|max_length[255]',
];
// Validation messages (optional)
protected $validationMessages = [];
// Skip validation (set to true to skip validation rules)
protected $skipValidation = false;
}