id->sortable(); $grid->logo->image('',50,50); $grid->name; $grid->column('mp_id','服务商')->display(function ($mid){ if($mid == 0) return '懒族自营'; $mp = LanzuMpInfo::find($mid); return $mp->name; }); $grid->column('status','状态')->display(function ($status){ if ($status==0){ return '禁用'; }else{ return '正常'; } }); $grid->address; $grid->column('addtime','创建时间'); $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 ImsCjdcMarket(), function (Show $show) { $show->id; $show->name; $show->logo->image(); $show->introduce; $show->imgs->image(); $show->addtime('创建时间'); $show->sort; $show->status; $show->coordinates; $show->remark; $show->address; $show->poundage; $show->dn_poundage; $show->dm_poundage; $show->yd_poundage; $show->dada_number; $show->is_open_dada; $show->loudspeaker_imei; $show->dishes_menu_intro; $show->create_time; $show->created_at; $show->updated_at; }); } /** * Make a form builder. * * @return Form */ protected function form() { return Form::make(new ImsCjdcMarket(), function (Form $form) { $form->display('id'); $form->text('name'); $form->select('mq_id','服务商')->options('/api/getMpInfo'); $form->text('address'); $form->text('coordinates'); $form->text('poundage'); $form->text('dn_poundage'); $form->text('dm_poundage'); $form->text('yd_poundage'); $form->text('loudspeaker_imei')->value(0); $form->number('sort','排序'); $form->number('status','状态'); $form->image('logo'); $form->multipleImage('imgs','市场图片'); $form->textarea('introduce'); $form->textarea('remark'); $form->textarea('dishes_menu_intro')->value('菜谱简介'); }); } /** * 服务商信息 * @return \Illuminate\Http\JsonResponse */ public function getMpInfo() { $mps = LanzuMpInfo::all(); $ret = []; foreach ($mps as $key => $value){ $item = []; $item['id'] = $value->id; $item['text'] = $value->name; $ret[] = $item; } return response()->json($ret); } }