芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/www/app/Http/Controllers/LanguageController.php
all(); 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; } Language::create($input); return back()->with('language_success','Language created successfully!'); } public function edit(Language $language) { return view('language.language-edit', compact('language')); } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param \App\Models\language $language * @return \Illuminate\Http\Response */ public function update(Request $request, Language $language) { $input = $request->all(); 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; } $language->update($input); return back()->with('language_success','Language updated successfully!'); } public function delete_language(Request $request, Language $language) { if(isset($request->delete_all) && !empty($request->checkbox_array)) { $languages = Language::findOrFail($request->checkbox_array); foreach ($languages as $language) { $language->delete(); } return back()->with('languages_success','Language/s deleted successfully!'); } else { return back(); } $languages = Language::findOrFail($request->checkbox_array); foreach ($languages as $language) { $language->delete(); } return back(); //return 'works'; } }