catchAdmin/catch/cms/tables/Articles.php

58 lines
2.0 KiB
PHP
Raw Normal View History

2021-05-22 11:02:45 +08:00
<?php
namespace catchAdmin\cms\tables;
use catcher\CatchTable;
use catchAdmin\cms\tables\forms\Factory;
use catcher\library\table\Actions;
use catcher\library\table\HeaderItem;
2021-05-26 18:37:00 +08:00
use catcher\library\table\Search;
2021-05-22 11:02:45 +08:00
class Articles extends CatchTable
{
public function table()
{
// TODO: Implement table() method.
return $this->getTable('articles')
->header([
2021-05-23 20:35:21 +08:00
HeaderItem::label('编号')->prop('id')->width(50),
2021-05-22 11:02:45 +08:00
2021-05-23 20:35:21 +08:00
HeaderItem::label('栏目')->prop('category')->width(100),
2021-05-22 11:02:45 +08:00
HeaderItem::label('标题')->prop('title'),
2021-05-23 20:35:21 +08:00
HeaderItem::label('创建人')->prop('creator')->width(100),
2021-05-22 11:02:45 +08:00
2021-05-23 20:35:21 +08:00
HeaderItem::label('权重')->prop('weight')->withEditNumberComponent()->width(100),
2021-05-22 11:02:45 +08:00
2021-05-23 20:35:21 +08:00
HeaderItem::label('置顶')->prop('is_top')->withSwitchComponent()->width(100),
HeaderItem::label('状态')->prop('status')->withSwitchComponent()->width(100),
HeaderItem::label('推荐')->prop('is_recommend')->withSwitchComponent()->width(100),
HeaderItem::label('创建时间')->prop('created_at')->width(150),
2021-05-22 11:02:45 +08:00
HeaderItem::label('操作')->actions([
Actions::update()->to('/cms/articles/detail'),
Actions::delete()
])
])
2021-05-26 18:37:00 +08:00
->withSearch([
Search::input('category', '栏目名称')->clearable(true),
Search::input('title', '文章标题')->clearable(true),
])
2021-05-22 11:02:45 +08:00
->withBind()
->withApiRoute('cms/articles')
->withActions([
Actions::create()->to('/cms/articles/detail/')
])
->render();
}
protected function form()
{
// TODO: Implement form() method.
return Factory::create('articles');
}
}