26 lines
600 B
PHP
Executable File
26 lines
600 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use CodeIgniter\Model;
|
|
|
|
class NavItemModel extends Model
|
|
{
|
|
protected $table = 'nav_items';
|
|
protected $primaryKey = 'id';
|
|
protected $useTimestamps = true;
|
|
protected $useSoftDeletes= true;
|
|
|
|
protected $allowedFields = [
|
|
'menu_parent_id','label','url','icon_class','target','sort_order','is_enabled'
|
|
];
|
|
|
|
public function getChildrenOf(int $parentId): array
|
|
{
|
|
return $this->where('parent_id', $parentId)
|
|
->where('is_enabled', 1)
|
|
->orderBy('sort_order', 'ASC')
|
|
->findAll();
|
|
}
|
|
}
|