Beispiel #1
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(SettingRequest $request, $id)
 {
     $setting = Setting::findOrFail($id);
     $setting->update($request->all());
     session()->flash('flash_message', 'Se han actualizado los datos del Blog');
     return redirect('admin/settings?tab=blog');
 }
 public function update($id, SettingRequest $request)
 {
     $this->setting->save($id, $request->all());
     if ($request->ajax()) {
         return response()->json(['status' => trans('messages.saved'), 'type' => 'success']);
     }
     $route = $request->get('task') == 'apply' ? route('admin.settings.edit', $id) : route('admin.settings.index');
     return redirect($route)->with(['status' => trans('messages.saved'), 'type' => 'success']);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function update(SettingRequest $request)
 {
     foreach ($request->all() as $name => $value) {
         if ($name != '_method' && $name != '_token') {
             $setting = Setting::whereName($name)->first();
             $setting->update(['value' => $value]);
         }
     }
     //更新设置缓存
     \Cache::forget('settings_array');
     return redirect('admin/settings/index');
 }
 /**
  * Save image to uploads folder and change the name to something unique
  *
  * @param SettingRequest $request
  * @param $field
  * @return array
  */
 private function storeImage(SettingRequest $request, $field)
 {
     $data = $request->except([$field]);
     if ($request->file($field)) {
         $file = $request->file($field);
         $request->file($field);
         $fileName = rename_file($file->getClientOriginalName(), $file->getClientOriginalExtension());
         $path = '/uploads/' . str_plural($field);
         $move_path = public_path() . $path;
         $file->move($move_path, $fileName);
         $data[$field] = $path . $fileName;
     }
     return $data;
 }
 public function store(Requests\SettingRequest $request)
 {
     return ['ok' => !!Setting::create($request->all())];
 }