<?php
namespace WpBookingEventAdmin\app\models;
defined('_WPBOOKINGEVENT_EXEC') or die;

use WpBookingEvent\Factory;
use WpBookingEvent\Mvc\Model\ModelForm;
use WpBookingEvent\Form\Form;
use WpBookingEvent\Mvc\Model\ModelList;
use WpBookingEvent\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;
    }
}
