Skip to content
关注公众号,获取新课通知

拖拽商品分类排序


控制器 app/controller/admin/Category.php

php
public function sortCategory(){
	$data = request()->param('sortdata');
	$data = json_decode($data,true);
	return showSuccess($this->M->saveAll($data));
}

验证器 app/validate/admin/Category.php

php
// 验证规则
protected $rule = [
    'sortdata'=>'require'
];

protected $scene = [
    // ...
    'sortCategory'=>['sortdata']
];

路由 router/admin.php

php
Route::post('category/sort','admin.Category/sortCategory');