reconstruction of the project
This commit is contained in:
@@ -7,13 +7,10 @@ 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
|
||||
// ✅ CI: useTimestamps = true
|
||||
public $timestamps = true;
|
||||
|
||||
protected $fillable = [
|
||||
'type',
|
||||
'category_id',
|
||||
@@ -37,13 +34,20 @@ class InventoryItem extends BaseModel
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'category_id' => 'integer',
|
||||
'quantity' => 'integer',
|
||||
'updated_by' => 'integer',
|
||||
|
||||
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
|
||||
'good_qty' => 'integer',
|
||||
'needs_repair_qty' => 'integer',
|
||||
'need_replace_qty' => 'integer',
|
||||
'cannot_find_qty' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
/* Optional relationships */
|
||||
public function category()
|
||||
{
|
||||
return $this->belongsTo(InventoryCategory::class, 'category_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user