50 lines
1.2 KiB
PHP
Executable File
50 lines
1.2 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Models\BaseModel;
|
|
|
|
class InventoryItem extends BaseModel
|
|
{
|
|
protected $table = 'inventory_items';
|
|
protected $primaryKey = 'id';
|
|
protected $useSoftDeletes = false;
|
|
public $timestamps = true;
|
|
const CREATED_AT = 'created_at';
|
|
const UPDATED_AT = 'updated_at';
|
|
|
|
// IMPORTANT: include everything you ever update/insert
|
|
protected $fillable = [
|
|
'type',
|
|
'category_id',
|
|
'name',
|
|
'description',
|
|
'quantity',
|
|
'good_qty',
|
|
'needs_repair_qty',
|
|
'need_replace_qty',
|
|
'cannot_find_qty',
|
|
'unit',
|
|
'condition',
|
|
'isbn',
|
|
'edition',
|
|
'sku',
|
|
'notes',
|
|
'semester',
|
|
'school_year',
|
|
'updated_by',
|
|
'created_at',
|
|
'updated_at',
|
|
];
|
|
|
|
|
|
protected $validationRules = [
|
|
'type' => 'required|in_list[classroom,book,office,kitchen]',
|
|
'name' => 'required|min_length[2]',
|
|
'quantity' => 'permit_empty|integer',
|
|
'unit_price' => 'permit_empty|decimal',
|
|
'semester' => 'permit_empty|in_list[Spring,Fall]',
|
|
'school_year' => 'permit_empty|max_length[16]', // e.g. 2025-2026
|
|
];
|
|
}
|