<?php
namespace WpBookingHotelAdminWooPanel\app\models;
defined('_WPBOOKINGHOTEL_EXEC') or die;

use WpBookingHotel\Factory;
use WpBookingHotel\Mvc\Model\ModelForm;
use WpBookingHotel\Form\Form;
use WpBookingHotel\Mvc\Model\ModelList;
use WpBookingHotel\Registry\Registry;
class CategoriesModel extends ModelList
{
    /**
     * @var string
     */
    public $context = "categories";
    /**
     * @var string
     */
    public $table_name = "category";

    public function sorting($list)
    {
        foreach ($list as $item){
            $item=(object)$item;
            $item_sorting=[
                'id'=> $item->id,
                'ordering'=>$item->ordering
            ];
            if(!parent::save($item_sorting)){
                return false;
            }
        }
        return true;
    }
}
