1
0
Fork 0

article caetgory

develop
panliang 2023-04-26 11:15:27 +08:00
parent 0e0fb98bd2
commit 64ed17e654
5 changed files with 33 additions and 13 deletions

View File

@ -15,8 +15,6 @@ class ArticleCategoryController extends AdminController
{
protected string $serviceName = ArticleCategoryService::class;
protected string $pageTitle = '文章分类';
public function list(): Page
{
$crud = $this->baseCRUD()
@ -28,12 +26,19 @@ class ArticleCategoryController extends AdminController
amis('reload')->align('right'),
amis('filter-toggler')->align('right'),
])
->quickSaveItemApi(admin_url('quick-edit/article-categories/$id'))
->columns([
TableColumn::make()->name('id')->label('ID'),
TableColumn::make()->name('name')->label('名称'),
TableColumn::make()->name('icon')->label('Icon')->type('image')->width(60),
TableColumn::make()->name('sort')->label('Sort'),
TableColumn::make()->name('is_enable')->type('status')->label('Enable'),
['name' => 'id', 'label' => __('article-category.id')],
['name' => 'name', 'label' => __('article-category.name')],
['name' => 'icon', 'label' => __('article-category.icon'), 'type' => 'image', 'width' => 60],
['name' => 'sort', 'label' => __('article-category.sort')],
['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),
]);
@ -54,10 +59,9 @@ class ArticleCategoryController extends AdminController
public function detail(): Form
{
return $this->baseDetail()->body([
TextControl::make()->static(true)->name('id')->label('ID'),
TextControl::make()->static(true)->name('name')->label('名称'),
TextControl::make()->static(true)->name('created_at')->label('创建时间'),
TextControl::make()->static(true)->name('updated_at')->label('更新时间')
['name' => 'id', 'type' => 'static', 'label' => __('article-category.id')],
['name' => 'name', 'type' => 'static', 'label' => __('article-category.name')],
['name' => 'created_at', 'type' => 'static', 'label' => __('article-category.created_at')],
]);
}

View File

@ -13,15 +13,16 @@ Route::group([
'prefix' => 'api',
], function (Router $router) {
$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->resource('admin-notices', \App\Admin\Controllers\AdminNoticeController::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);
//图片位置

View File

@ -15,6 +15,7 @@ class ArticleCategory extends Model
protected $casts = [
'created_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'];

View File

@ -188,4 +188,8 @@ return [
'selected_rows_no_data' => '请选择要导出的数据',
'please_install_laravel_excel' => '请先安装 laravel-excel 扩展',
],
'switch' => [
'on' => '开启',
'off' => '关闭',
]
];

View File

@ -0,0 +1,10 @@
<?php
return [
'id' => 'ID',
'name' => '名称',
'icon' => '图片',
'sort' => '排序',
'is_enable' => '状态',
'created_at' => '创建时间',
];