47 lines
1.2 KiB
PHP
47 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use CodeIgniter\Model;
|
|
use App\Models\Concerns\SchoolYearAutoFillTrait;
|
|
|
|
class InvoiceLineModel extends Model
|
|
{
|
|
use SchoolYearAutoFillTrait;
|
|
|
|
protected $table = 'invoice_lines';
|
|
protected $primaryKey = 'id';
|
|
protected $returnType = 'array';
|
|
protected $useTimestamps = false;
|
|
|
|
protected $allowedFields = [
|
|
'invoice_id',
|
|
'school_year',
|
|
'line_type',
|
|
'source_type',
|
|
'source_id',
|
|
'active_source_key',
|
|
'description',
|
|
'quantity',
|
|
'unit_amount_cents',
|
|
'line_amount_cents',
|
|
'discount_eligible',
|
|
'calculation_version',
|
|
'metadata_json',
|
|
'created_at',
|
|
'updated_at',
|
|
'voided_at',
|
|
];
|
|
|
|
protected $validationRules = [
|
|
'invoice_id' => 'required|integer',
|
|
'school_year' => 'required|string|max_length[9]',
|
|
'line_type' => 'required|max_length[50]',
|
|
'description' => 'required|max_length[255]',
|
|
'quantity' => 'required|decimal',
|
|
'unit_amount_cents' => 'required|integer',
|
|
'line_amount_cents' => 'required|integer',
|
|
'discount_eligible' => 'required|in_list[0,1]',
|
|
];
|
|
}
|