public function destroy($id) { $Src = Images::find($id)->imageSrc; $imageSrc = URL::to('/') . '/' . $Src; File::delete($imageSrc); Images::find($id)->delete(); return redirect(URL::previous())->withSuccess(Lang::get('messages.delete_success')); }
public function destroy($id) { DB::transaction(function () use($id) { }); $imageSrc = Images::find($id)->imageSrc; unlink($imageSrc); Images::find($id)->delete(); DB::commit(); return redirect(URL::previous())->withSuccess(Lang::get('messages.delete_success')); }
public function postMove() { $rules = array('new_album' => 'required|numeric|exists:albums,id', 'photo' => 'required|numeric|exists:images,id'); $validator = Validator::make(Input::all(), $rules); if ($validator->fails()) { return Redirect::route('index'); } $image = Images::find(Input::get('photo')); $image->album_id = Input::get('new_album'); $image->save(); return Redirect::route('show_album', array('id' => Input::get('new_album'))); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id, $type = '') { // $data = Images::find($id); if (Gate::denies('delete', $data)) { abort(403, "You have no rights to do this "); } else { File::delete(public_path() . "\\uploads\\images\\" . $data->name); $isdelete = $data->delete(); if ($type == '') { $response = Response::json(array("files" => "Success")); return $response; } else { return redirect('/images/list/' . $type)->with('status', "File Removed Successfully"); } } }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { $image = Images::find($id); return view('gallery.show', compact('image')); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $image = Images::find($id); $image->delete(); // return redirect()->back(); }