pluck('value','key'); $level_list = $this->getLevelList($configs->get('receive_level_id')); return view('admins.configs.index',['configs'=>$configs,'levelList' => json_encode($level_list, JSON_UNESCAPED_SLASHES)]); } /** * 获取层级菜单组件 * @return array */ private function getLevelList($level = '0') { $option = [ 'checked' => $level . '', 'attr' => [ [ 'value' => '0', 'label' => "L0", 'disabled' => false, 'notice' => '*' ], ] ]; $levels=Level::select(['id','name'])->get(); foreach ($levels as $level){ $option['attr'][]=[ 'value' => $level->{'id'}.'', 'label' => $level->{'name'}, 'disabled' => false, 'notice' => '*' ]; } return $option; } function use_expense(){ if(request()->isMethod('post')){ $data=request()->all(); if(isset($data['_token']))unset($data['_token']); ExpenseMoney::where('id',1)->update($data); return $this->response(self::SUCCESS_MSG,'success','',route('admin.config.on_order_set')); }else{ $configs=ExpenseMoney::where('id',1)->first(); return view('admins.configs.use_expense',['configs'=>$configs]); } } /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function about_us() { $configs=Config::whereIn('key',['about_us','privacy_protocol'])->pluck('value','key'); return view('admins.configs.about_us',['configs'=>$configs]); } /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function agreement() { $configs=Config::where('key','agreement')->pluck('value','key'); return view('admins.configs.agreement',['configs'=>$configs]); } /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function beans() { $configs=Config::where('key','beans')->pluck('value','key'); return view('admins.configs.beans',['configs'=>$configs]); } /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function order_set() { $configs=Config::whereIn('key',['order_affirm','order_finish'])->pluck('value','key'); return view('admins.configs.order_set',['configs'=>$configs]); } function consume(){ $configs=Config::whereIn('key',['consume_money','consume_for','consume_give'])->pluck('value','key'); return view('admins.configs.consume',['configs'=>$configs]); } /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function indexDown() { $configs=Config::pluck('value','key'); return view('admins.configs.indexDown',['configs'=>$configs]); } function update_new1(){ foreach ( request()->all() as $key => $value ){ // 查找当前数据是否存在 if( Config::where('key', $key)->where('value', $value)->count() ){ continue; } Config::where('key', $key)->update([ 'value' => $value ]); } return $this->response(self::SUCCESS_MSG,'success',''); } }