分类下拉
This commit is contained in:
@@ -18,6 +18,21 @@ class PostCategoryController extends BaseController
|
||||
$this->service = new PostCategoryService();
|
||||
}
|
||||
|
||||
public function preset(Request $request)
|
||||
{
|
||||
try {
|
||||
$raw = $this->service->serviceListAll($request);
|
||||
$data = [];
|
||||
foreach ($raw as $item) {
|
||||
unset($item['created_at']);
|
||||
unset($item['updated_at']);
|
||||
$data[] = $this->indexFormat($item);
|
||||
}
|
||||
return $this->success($data);
|
||||
} catch (\Throwable $e) {
|
||||
return $this->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分类树
|
||||
|
||||
@@ -177,6 +177,7 @@ Route::group('/admin', function () {
|
||||
Route::any('/store', [app\admin\controller\PostCategoryController::class, 'store']);
|
||||
Route::any('/update', [app\admin\controller\PostCategoryController::class, 'update']);
|
||||
Route::any('/destroy', [app\admin\controller\PostCategoryController::class, 'destroy']);
|
||||
Route::any('/preset', [app\admin\controller\PostCategoryController::class, 'preset']);
|
||||
});
|
||||
|
||||
// 点赞
|
||||
|
||||
Reference in New Issue
Block a user