123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <?php
- namespace App\Admin\Controllers\Shop;
- use App\Admin\Repositories\Shop\WxShopNotice;
- use Dcat\Admin\Form;
- use Dcat\Admin\Grid;
- use Dcat\Admin\Show;
- use Dcat\Admin\Http\Controllers\AdminController;
- class WxShopNoticeController extends AdminController
- {
- /**
- * Make a grid builder.
- *
- * @return Grid
- */
- protected function grid()
- {
- return Grid::make(new WxShopNotice(), function (Grid $grid) {
- $grid->simplePaginate();
- $grid->model()->orderBy('id', 'desc');
- $grid->column('id')->sortable();
- $grid->column('title');
- $grid->column('content')->limit(8);
- $grid->column('state')->switch();
- $grid->column('created_at');
- $grid->column('updated_at')->sortable();
- $grid->filter(function (Grid\Filter $filter) {
- $filter->equal('id');
- });
- });
- }
- /**
- * Make a show builder.
- *
- * @param mixed $id
- *
- * @return Show
- */
- protected function detail($id)
- {
- return Show::make($id, new WxShopNotice(), function (Show $show) {
- $show->field('id');
- $show->field('title');
- $show->field('content');
- $show->field('state');
- $show->field('created_at');
- $show->field('updated_at');
- });
- }
- /**
- * Make a form builder.
- *
- * @return Form
- */
- protected function form()
- {
- return Form::make(new WxShopNotice(), function (Form $form) {
- $form->display('id');
- $form->text('title');
- if(__system_is_model_enable('laradocs', 'dcat-neditor')){
- $form->neditor('content');
- }else{
- $form->editor('content');
- }
- $form->switch('state');
- $form->deleting(function (Form $form){
- global $__MINI_GLOBAL_TENANT_ID__;
- if($__MINI_GLOBAL_TENANT_ID__ > 0){
- return $form->response()->error('权限不足,不可以删除其他分站对象');
- }
- });
- });
- }
- }
|