123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- <?php
- namespace App\Admin\Controllers\Shop;
- use App\Admin\Repositories\Shop\WxShopAddress;
- use Dcat\Admin\Form;
- use Dcat\Admin\Grid;
- use Dcat\Admin\Show;
- use Dcat\Admin\Http\Controllers\AdminController;
- class WxShopAddressController extends AdminController
- {
- /**
- * Make a grid builder.
- *
- * @return Grid
- */
- protected function grid()
- {
- return Grid::make(new WxShopAddress(['user']), function (Grid $grid) {
- $grid->simplePaginate();
- $grid->quickSearch(['id', 'user.user_name', 'name', 'mobile', 'province', 'city', 'county', 'adds'])->placeholder('搜索地址ID,用户名字,名称,手机号,省份等...')->width(30);
- $grid->model()->orderBy('id', 'desc');
- $grid->column('id')->sortable();
- $grid->column('user.user_avatar','头像')->image('',30,30);
- $grid->column('user.user_name','用户');
- $grid->column('name');
- $grid->column('mobile');
- $grid->column('province');
- $grid->column('city');
- $grid->column('county');
- $grid->column('adds');
- // $grid->column('user_id');
- $grid->column('is_check')->using([0=>'否',1=>'是'])->label([
- 0=>'default',
- 1=>'green'
- ]);
- $grid->column('state')->using([0 => '正常', 1 => '用户删除'])->label([
- 0 => 'primary',
- 1 => 'default',
- ]);
- $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 WxShopAddress(), function (Show $show) {
- $show->field('id');
- $show->field('name');
- $show->field('mobile');
- $show->field('province');
- $show->field('city');
- $show->field('county');
- $show->field('adds');
- $show->field('user_id');
- $show->field('is_check');
- $show->field('state');
- $show->field('created_at');
- $show->field('updated_at');
- });
- }
- /**
- * Make a form builder.
- *
- * @return Form
- */
- protected function form()
- {
- return Form::make(new WxShopAddress(), function (Form $form) {
- $form->display('id');
- $form->text('name');
- $form->text('mobile');
- $form->text('province');
- $form->text('city');
- $form->text('county');
- $form->text('adds');
- $form->text('user_id');
- $form->text('is_check');
- $form->text('state');
- $form->deleting(function (Form $form){
- global $__MINI_GLOBAL_TENANT_ID__;
- if($__MINI_GLOBAL_TENANT_ID__ > 0){
- return $form->response()->error('权限不足,不可以删除其他分站对象');
- }
- });
- });
- }
- }
|