response()->alert()->error("设置失败1"); }else{ $agent_seller_id = (int)data_get($input,'agent_seller_id',0); $agentSeller = Seller::find($agent_seller_id); if (!$agentSeller) { return $this->response()->alert()->error("该代理不存在"); } $shop = Shop::where('id',$input['id'])->first(); if (empty($shop)){ return $this->response()->alert()->error("店铺不存在"); } $shop->agent_seller_id = $agentSeller->id; $shop->agent_shop_id = $agentSeller->shop_id; $shop->save(); return $this->response()->success("设置成功")->refresh(); } } public function form() { $shop_id = $this->payload['id']; $shops = Shop::where('id',$shop_id)->first(); $this->display('shop_sn','店铺编号')->with(function ($item)use($shops){ return $shops['shop_sn']; }); $this->display('shop_name','店铺名称')->with(function ($item)use($shops){ return $shops['name']; }); $this->select('agent_seller_id','平台代理')->options(Seller::pluck('name','id'))->help('请谨慎选择正确的平台代理'); $this->hidden('id')->value($shop_id); } }