芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/www/app/Http/Controllers/SettingController.php
language)) { $data['lang_id'] = 0; $data['setting'] = Setting::firstOrFail(); } else { $lang = Language::where('code', $request->language)->firstOrFail(); $data['lang_id'] = $lang->id; $data['setting'] = Setting::findOrFail($lang->id); } return view('settings.edit', $data, compact('langs')); } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param \App\Models\setting $setting * @return \Illuminate\Http\Response */ public function update(Request $request, Setting $setting, $langid) { $setting = Setting::where('language_id', $langid)->firstOrFail(); $input = $request->all(); $this->validate($request, [ 'photo_id' => 'mimes:jpg,jpeg,png,webp,gif,svg'] ); if ($file = $request->file('photo_id')) { $name = time() . $file->getClientOriginalName(); $file->move('images/media/', $name); $photo = Photo::create(['file'=>$name]); $input['photo_id'] = $photo->id; } $setting->update($input); return back()->with('setting_success','Settings updated successfully!'); } }