'required|alpha_numeric|max_length[20]', 'PONO' => 'permit_empty|alpha_numeric|max_length[27]', 'ReqNo' => 'required|alpha_numeric|max_length[20]', 'ItemNo' => 'permit_empty|integer', 'MaterialCode' => 'required|alpha_numeric|max_length[20]', 'Quantity' => 'required|decimal', 'Rate' => 'required|decimal', 'ReceivedQuantity' => 'required|decimal', 'AmendmentQuantity' => 'permit_empty|decimal', 'AmendmentRemarks' => 'permit_empty|string|max_length[20]', 'ServiceMaterialDescription' => 'permit_empty|string', 'AmendedDetails' => 'permit_empty|string', 'Status' => 'required|string|max_length[20]', 'OGR_Status' => 'permit_empty|string|max_length[50]', 'CreatedBy' => 'required|string|max_length[50]', 'UpdateBY' => 'required|string|max_length[50]', 'CostCenterCode' => 'permit_empty|alpha_numeric|max_length[5]', 'ServiceFrequency' => 'permit_empty|string|max_length[100]', 'Per' => 'permit_empty|string|max_length[50]', ]; // Validation messages protected $validationMessages = [ 'LineItemNo' => [ 'required' => 'Line Item Number is required.', 'alpha_numeric' => 'Line Item Number must be alphanumeric.', ], 'MaterialCode' => [ 'required' => 'Material Code is required.', ], // Add custom messages for other fields as needed ]; // Skip validation protected $skipValidation = false; /** * Custom function to fetch line items by PONO * @param string $pono * @return array */ public function getByPONO(string $pono) { return $this->where('PONO', $pono)->findAll(); } /** * Custom function to update the status of a line item * @param string $lineItemNo * @param string $status * @return bool */ public function updateStatus(string $lineItemNo, string $status): bool { return $this->update($lineItemNo, ['Status' => $status]); } }