order('sort') ->paginate([ 'list_rows'=> $get['limit'], 'page'=> $get['page'], ]); return ['count' => $lists->total(), 'lists' => $lists->getCollection()]; } /** * Notes: 添加 * @param $post * @return GoodsBrand|\think\Model *@author 段誉(2021/4/15 10:54) */ public static function add($post) { return GoodsBrand::create([ 'name' => $post['name'], 'initial' => $post['initial'], 'image' => $post['image'] ?? '', 'sort' => $post['sort'] ?? 100, 'is_show' => $post['is_show'], 'remark' => $post['remark'] ?? '', ]); } /** * Notes: 编辑 * @param $post * @return GoodsBrand *@author 段誉(2021/4/15 10:54) */ public static function edit($post) { return GoodsBrand::update([ 'name' => $post['name'], 'initial' => $post['initial'], 'image' => $post['image'] ?? '', 'sort' => $post['sort'] ?? 100, 'is_show' => $post['is_show'], 'remark' => $post['remark'] ?? '', ], ['id' => $post['id']]); } /** * Notes: 删除 * @param $id * @return GoodsBrand *@author 段誉(2021/4/15 10:54) */ public static function del($id) { return GoodsBrand::update(['del' => 1], ['id' => $id]); } }