/** * view pics for a particular gallery */ public function viewGalleryPics($id) { // a gallery is specific to a user id $gallery = Gallery::findOrFail($id); // should catch the exception and redirect to proper page return view('gallery.gallery-view')->with('gallery', $gallery); }
public function getGalleryImages($galleryId) { $gallery = Gallery::findOrFail($galleryId); $set = $gallery->getOrdered()->map(function ($item) { return ['image_id' => $item->id, 'src' => $item->getUrl(), 'thumb_src' => $item->getUrl('thumb')]; }); return response()->json($set); }
/** * Helper untuk melakukan Update new Data ke dalam database * @param int $id */ private function updateData($id = 0) { $data = Gallery::findOrFail($id); $file = Input::file('gallery'); $image_name = time() . "-gallery-" . $file->getClientOriginalName(); $file->move(public_path() . '/upload', $image_name); $data->image = $image_name; $data->save(); return true; }
public function viewGalleryPics($id) { $gallery = Gallery::findOrFail($id); return view('gallery.gallery-view')->with('gallery', $gallery); }
public function getGallery($gallery_id) { $gallery = Gallery::findOrFail($gallery_id); $pictures = $gallery->pictures; return response()->json(['data' => $pictures->toArray(), 'gallery_title' => $gallery->title, 'description' => $gallery->description]); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $gallery = Gallery::findOrFail($id); $name = $gallery->name; $gallery->delete(); flashMessage("'{$name}' has been deleted.", "alert-success"); return redirect('galleries'); }
public function deletePicture($id, $picture) { $gallery = Gallery::findOrFail($id); $pictureDB = Picture::findOrFail($picture); unlink(base_path() . '/public/images/galleries/' . $gallery->id . '/' . $pictureDB->picture); Picture::destroy($picture); return redirect(route('admin.galleries.editPictures', $gallery))->with('success', 'L\'image a bien été supprimée'); }