<?php

namespace Modules\Menu\Models;

use CodeIgniter\Model;

class MenusCategoryModel extends Model
{

  protected $table = 'menu_type';
    protected $primaryKey = 'id';

    protected $allowedFields = ['name', 'alias', 'description', 'created_by', 'updated_at', 'updated_by'];

    protected $returnType     = 'array';
    protected $useTimestamps  = true;
    protected $useSoftDeletes = true;
    
    protected $createdField  = 'created_at';
    protected $updatedField  = 'updated_at';
    protected $deletedField  = 'deleted_at';

    //Get all Post Categories
    public function getAll()
    {
      $builder = $this->db->table('menu_type');
      $builder->orderBy('id', 'DESC');
		  $result = $builder->get()->getResult();
		  return $result;
    }

    public function getSingleGroup($id)
    {
      $builder = $this->db->table('menu_type');
      $builder->where('alias', $id);
      return $result = $builder->get()->getRow();
    }

}
