route(); $arr = explode("/",$route->uri); $this->type = $arr[3]; } /** * Make a grid builder. * * @return Grid */ protected function grid() { return Grid::make(new Setting(), function (Grid $grid) { $grid->column('id')->sortable(); if($this->type == self::TYPE_BASIC){ $grid->column('name'); $grid->column('logo')->image('',150); $grid->column('contact')->editable(); }elseif($this->type == self::TYPE_TIPS){ $grid->column('tips')->editable(); }else{ $grid->column('recharge_bg_img')->image('',150);; $grid->column('recharge_button_txt'); $grid->column('recharge_desc'); } $grid->disableDeleteButton(); $grid->disableCreateButton(); $grid->disableViewButton(); $grid->disableRowSelector(); }); } /** * Make a show builder. * * @param mixed $id * * @return Show */ protected function detail($id) { return Show::make($id, new Setting(), function (Show $show) { $show->field('id'); $show->field('name'); $show->field('logo'); $show->field('contact'); $show->field('tips'); $show->field('is_watch_auto_pay'); $show->field('recharge_bg_img'); $show->field('recharge_button_txt'); $show->field('recharge_desc'); $show->field('created_at'); $show->field('updated_at'); }); } /** * Make a form builder. * * @param $type * @return Form */ protected function form() { return Form::make(new Setting(), function (Form $form) { $form->display('id'); if($this->type == self::TYPE_BASIC){ $form->text('name'); $form->image('logo')->saveFullUrl() ->uniqueName()->autoUpload() ->autoSave(false) ->removable(false) ->width(4); $form->text('contact')->minLength(11)->maxLength(11); }elseif($this->type == self::TYPE_TIPS){ $form->text('tips'); }else{ $form->image('recharge_bg_img')->saveFullUrl() ->uniqueName()->autoUpload() ->autoSave(false) ->removable(false) ->width(4); $form->text('recharge_button_txt')->maxLength(10); $form->textarea('recharge_desc'); } $form->disableViewButton(); $form->disableDeleteButton(); $form->disableListButton(); $form->disableEditingCheck(); $form->disableViewCheck(); }); } }