Exemplo n.º 1
0
 public function remove($id)
 {
     if (!Request::ajax()) {
         return App::abort(404);
     }
     $filename = Input::get('filename');
     $remove = OrderGallery::where('id', $id)->delete();
     if ($remove) {
         if (unlink(public_path('img/' . $filename))) {
             return ['success' => true];
         } else {
             return ['message' => 'Whoops, something went wrong ! Please try again'];
         }
     }
     return ['message' => 'Whoops, something went wrong ! Please try again'];
 }
Exemplo n.º 2
0
 /**
  * User order/gallery
  *
  * @param  array  $option
  * @return \Illuminate\Database\Eloquent\Model
  */
 public function getOrderGallery(array $option = array())
 {
     $gallery = \OrderGallery::orderBy('id', 'desc');
     if (isset($option['order_id'])) {
         $gallery = $gallery->where('order_id', $option['order_id']);
     }
     $gallery = $gallery->paginate(20);
     if ($gallery) {
         return $gallery;
     } else {
         return false;
     }
 }