update cms
This commit is contained in:
@@ -5,6 +5,7 @@ use catcher\CatchTable;
|
||||
use catchAdmin\cms\tables\forms\Factory;
|
||||
use catcher\library\table\Actions;
|
||||
use catcher\library\table\HeaderItem;
|
||||
use catcher\library\table\Search;
|
||||
|
||||
class Articles extends CatchTable
|
||||
{
|
||||
@@ -36,6 +37,10 @@ class Articles extends CatchTable
|
||||
Actions::delete()
|
||||
])
|
||||
])
|
||||
->withSearch([
|
||||
Search::input('category', '栏目名称')->clearable(true),
|
||||
Search::input('title', '文章标题')->clearable(true),
|
||||
])
|
||||
->withBind()
|
||||
->withApiRoute('cms/articles')
|
||||
->withActions([
|
||||
|
52
catch/cms/tables/Comments.php
Normal file
52
catch/cms/tables/Comments.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
namespace catchAdmin\cms\tables;
|
||||
|
||||
use catcher\CatchTable;
|
||||
use catchAdmin\cms\tables\forms\Factory;
|
||||
use catcher\library\table\Actions;
|
||||
use catcher\library\table\HeaderItem;
|
||||
use catcher\library\table\Search;
|
||||
|
||||
class Comments extends CatchTable
|
||||
{
|
||||
public function table()
|
||||
{
|
||||
// TODO: Implement table() method.
|
||||
return $this->getTable('comments')
|
||||
->header([
|
||||
HeaderItem::label('编号')->prop('id')->width(50),
|
||||
|
||||
HeaderItem::label('文章标题')->prop('title'),
|
||||
|
||||
HeaderItem::label('评论')->prop('content'),
|
||||
|
||||
HeaderItem::label('用户昵称')->prop('username'),
|
||||
|
||||
HeaderItem::label('ip')->prop('ip'),
|
||||
|
||||
HeaderItem::label('状态')->prop('status')->withSwitchComponent(),
|
||||
|
||||
HeaderItem::label('创建时间')->prop('created_at'),
|
||||
|
||||
HeaderItem::label('操作')->actions([
|
||||
Actions::delete(),
|
||||
])
|
||||
])
|
||||
->withSearch([
|
||||
Search::input('title', '文章标题')->clearable(true),
|
||||
|
||||
Search::input('username', '用户名称')->clearable(true),
|
||||
|
||||
Search::label('状态')->status('请选择状态')->clearable(true),
|
||||
])
|
||||
->withBind()
|
||||
->withApiRoute('/cms/comments')
|
||||
->render();
|
||||
}
|
||||
|
||||
protected function form()
|
||||
{
|
||||
// TODO: Implement form() method.
|
||||
return Factory::create('comments');
|
||||
}
|
||||
}
|
59
catch/cms/tables/Users.php
Normal file
59
catch/cms/tables/Users.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
namespace catchAdmin\cms\tables;
|
||||
|
||||
use catcher\CatchTable;
|
||||
use catchAdmin\cms\tables\forms\Factory;
|
||||
use catcher\library\table\Actions;
|
||||
use catcher\library\table\HeaderItem;
|
||||
use catcher\library\table\Search;
|
||||
|
||||
class Users extends CatchTable
|
||||
{
|
||||
public function table()
|
||||
{
|
||||
// TODO: Implement table() method.
|
||||
return $this->getTable('users')
|
||||
->header([
|
||||
HeaderItem::label('编号')->prop('id')->width(50),
|
||||
|
||||
HeaderItem::label('用户名')->prop('username'),
|
||||
|
||||
HeaderItem::label('头像')->prop('avatar')->withPreviewComponent(),
|
||||
|
||||
HeaderItem::label('邮箱')->prop('email'),
|
||||
|
||||
HeaderItem::label('手机号')->prop('mobile'),
|
||||
|
||||
HeaderItem::label('状态')->prop('status')->withSwitchComponent(),
|
||||
|
||||
HeaderItem::label('创建时间')->prop('created_at'),
|
||||
|
||||
HeaderItem::label('操作')->actions([
|
||||
Actions::update(),
|
||||
Actions::delete()
|
||||
])
|
||||
])
|
||||
->withActions([
|
||||
Actions::create()
|
||||
])
|
||||
->withSearch([
|
||||
Search::input('username', '用户名')->clearable(true),
|
||||
|
||||
Search::input('email', '邮箱')->clearable(true),
|
||||
|
||||
Search::input('mobile', '手机号')->clearable(true),
|
||||
|
||||
Search::label('状态')->status()->clearable(true),
|
||||
])
|
||||
->withBind()
|
||||
->withApiRoute('/cms/users')
|
||||
->render();
|
||||
}
|
||||
|
||||
protected function form()
|
||||
{
|
||||
// TODO: Implement form() method.
|
||||
return Factory::create('users');
|
||||
}
|
||||
|
||||
}
|
15
catch/cms/tables/forms/Comments.php
Normal file
15
catch/cms/tables/forms/Comments.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
namespace catchAdmin\cms\tables\forms;
|
||||
|
||||
use catcher\library\form\Form;
|
||||
|
||||
class Comments extends Form
|
||||
{
|
||||
public function fields(): array
|
||||
{
|
||||
// TODO: Implement fields() method.
|
||||
return [
|
||||
|
||||
];
|
||||
}
|
||||
}
|
34
catch/cms/tables/forms/Users.php
Normal file
34
catch/cms/tables/forms/Users.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
namespace catchAdmin\cms\tables\forms;
|
||||
|
||||
use catcher\library\form\Form;
|
||||
|
||||
class Users extends Form
|
||||
{
|
||||
public function fields(): array
|
||||
{
|
||||
// TODO: Implement fields() method.
|
||||
return [
|
||||
self::input('username', '用户名')->required()->clearable(true),
|
||||
|
||||
self::image('头像', 'avatar'),
|
||||
|
||||
self::email('email', '邮箱')->required()->clearable(true),
|
||||
|
||||
self::input('password', '密码')->required()->appendValidates([
|
||||
self::validatePassword()
|
||||
])->clearable(true),
|
||||
|
||||
self::input('mobile', '手机号')->appendValidates([
|
||||
self::validateMobile()
|
||||
])->clearable(true),
|
||||
|
||||
|
||||
self::radio('status', '状态', \catchAdmin\cms\model\Users::ENABLE)
|
||||
->options(
|
||||
self::options()->add('启用', \catchAdmin\cms\model\Users::ENABLE)
|
||||
->add('禁用', \catchAdmin\cms\model\Users::DISABLE)->render()
|
||||
)
|
||||
];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user