article caetgory
parent
0e0fb98bd2
commit
64ed17e654
|
|
@ -15,8 +15,6 @@ class ArticleCategoryController extends AdminController
|
||||||
{
|
{
|
||||||
protected string $serviceName = ArticleCategoryService::class;
|
protected string $serviceName = ArticleCategoryService::class;
|
||||||
|
|
||||||
protected string $pageTitle = '文章分类';
|
|
||||||
|
|
||||||
public function list(): Page
|
public function list(): Page
|
||||||
{
|
{
|
||||||
$crud = $this->baseCRUD()
|
$crud = $this->baseCRUD()
|
||||||
|
|
@ -28,12 +26,19 @@ class ArticleCategoryController extends AdminController
|
||||||
amis('reload')->align('right'),
|
amis('reload')->align('right'),
|
||||||
amis('filter-toggler')->align('right'),
|
amis('filter-toggler')->align('right'),
|
||||||
])
|
])
|
||||||
|
->quickSaveItemApi(admin_url('quick-edit/article-categories/$id'))
|
||||||
->columns([
|
->columns([
|
||||||
TableColumn::make()->name('id')->label('ID'),
|
['name' => 'id', 'label' => __('article-category.id')],
|
||||||
TableColumn::make()->name('name')->label('名称'),
|
['name' => 'name', 'label' => __('article-category.name')],
|
||||||
TableColumn::make()->name('icon')->label('Icon')->type('image')->width(60),
|
['name' => 'icon', 'label' => __('article-category.icon'), 'type' => 'image', 'width' => 60],
|
||||||
TableColumn::make()->name('sort')->label('Sort'),
|
['name' => 'sort', 'label' => __('article-category.sort')],
|
||||||
TableColumn::make()->name('is_enable')->type('status')->label('Enable'),
|
['name' => 'is_enable', 'label' => __('article-category.is_enable'), 'type' => 'switch', 'quickEdit' => [
|
||||||
|
'type' => 'switch',
|
||||||
|
'mode' => 'inline',
|
||||||
|
'onText' => __('admin.switch.on'),
|
||||||
|
'offText' => __('admin.switch.off'),
|
||||||
|
'saveImmediately' => true,
|
||||||
|
]],
|
||||||
$this->rowActions(true),
|
$this->rowActions(true),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
@ -54,10 +59,9 @@ class ArticleCategoryController extends AdminController
|
||||||
public function detail(): Form
|
public function detail(): Form
|
||||||
{
|
{
|
||||||
return $this->baseDetail()->body([
|
return $this->baseDetail()->body([
|
||||||
TextControl::make()->static(true)->name('id')->label('ID'),
|
['name' => 'id', 'type' => 'static', 'label' => __('article-category.id')],
|
||||||
TextControl::make()->static(true)->name('name')->label('名称'),
|
['name' => 'name', 'type' => 'static', 'label' => __('article-category.name')],
|
||||||
TextControl::make()->static(true)->name('created_at')->label('创建时间'),
|
['name' => 'created_at', 'type' => 'static', 'label' => __('article-category.created_at')],
|
||||||
TextControl::make()->static(true)->name('updated_at')->label('更新时间')
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,15 +13,16 @@ Route::group([
|
||||||
'prefix' => 'api',
|
'prefix' => 'api',
|
||||||
], function (Router $router) {
|
], function (Router $router) {
|
||||||
$router->get('keywords/tree-list', '\App\Admin\Controllers\KeywordController@getTreeList')->name('api.keywords.tree-list');
|
$router->get('keywords/tree-list', '\App\Admin\Controllers\KeywordController@getTreeList')->name('api.keywords.tree-list');
|
||||||
$router->get('article-categories/tree-list', '\App\Admin\Controllers\ArticleCategoryController@getTreeList')->name('api.article-categories.tree-list');
|
$router->get('article-categories/tree-list', [\App\Admin\Controllers\ArticleCategoryController::class, 'getTreeList'])->name('api.article-categories.tree-list');
|
||||||
});
|
});
|
||||||
|
|
||||||
$router->get('dashboard', '\App\Admin\Controllers\HomeController@index');
|
$router->get('dashboard', '\App\Admin\Controllers\HomeController@index');
|
||||||
|
|
||||||
//公告管理
|
//公告管理
|
||||||
$router->resource('admin-notices', \App\Admin\Controllers\AdminNoticeController::class);
|
$router->resource('admin-notices', \App\Admin\Controllers\AdminNoticeController::class);
|
||||||
//文章分类
|
// 文章分类
|
||||||
$router->resource('article-categories', \App\Admin\Controllers\ArticleCategoryController::class);
|
$router->resource('article-categories', \App\Admin\Controllers\ArticleCategoryController::class);
|
||||||
|
$router->post('quick-edit/article-categories/{article_category}', [\App\Admin\Controllers\ArticleCategoryController::class, 'update']);
|
||||||
//文章管理
|
//文章管理
|
||||||
$router->resource('articles', \App\Admin\Controllers\ArticleController::class);
|
$router->resource('articles', \App\Admin\Controllers\ArticleController::class);
|
||||||
//图片位置
|
//图片位置
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ class ArticleCategory extends Model
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'created_at' => 'datetime:Y-m-d H:i:s',
|
'created_at' => 'datetime:Y-m-d H:i:s',
|
||||||
'updated_at' => 'datetime:Y-m-d H:i:s',
|
'updated_at' => 'datetime:Y-m-d H:i:s',
|
||||||
|
'is_enable' => 'boolean',
|
||||||
];
|
];
|
||||||
|
|
||||||
protected $fillable = ['icon', 'is_enable', 'level', 'name', 'parent_id', 'path', 'sort'];
|
protected $fillable = ['icon', 'is_enable', 'level', 'name', 'parent_id', 'path', 'sort'];
|
||||||
|
|
|
||||||
|
|
@ -188,4 +188,8 @@ return [
|
||||||
'selected_rows_no_data' => '请选择要导出的数据',
|
'selected_rows_no_data' => '请选择要导出的数据',
|
||||||
'please_install_laravel_excel' => '请先安装 laravel-excel 扩展',
|
'please_install_laravel_excel' => '请先安装 laravel-excel 扩展',
|
||||||
],
|
],
|
||||||
|
'switch' => [
|
||||||
|
'on' => '开启',
|
||||||
|
'off' => '关闭',
|
||||||
|
]
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'id' => 'ID',
|
||||||
|
'name' => '名称',
|
||||||
|
'icon' => '图片',
|
||||||
|
'sort' => '排序',
|
||||||
|
'is_enable' => '状态',
|
||||||
|
'created_at' => '创建时间',
|
||||||
|
];
|
||||||
Loading…
Reference in New Issue