recreate project
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class InventoryCategoryModel extends Model
|
||||
{
|
||||
protected $table = 'inventory_categories';
|
||||
protected $primaryKey = 'id';
|
||||
protected $returnType = 'array';
|
||||
protected $useTimestamps = true;
|
||||
|
||||
protected $allowedFields = [
|
||||
'type',
|
||||
'name',
|
||||
'description',
|
||||
'grade_min',
|
||||
'grade_max',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
public function optionsForType(string $type): array
|
||||
{
|
||||
return $this->select('id, name, description, grade_min, grade_max')
|
||||
->where('type', $type)
|
||||
->orderBy('name', 'ASC')
|
||||
->findAll(); // returnType already 'array'
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user