Пример #1
0
 public function deleteGallery($id)
 {
     $user = Auth::user();
     $gallery = Gallery::whereIn('user_id', function ($query) use($user) {
         $query->select('id')->from('users')->where('id', $user->id);
     })->where('id', $id)->first();
     if (!$gallery) {
         return response()->json(['status' => 'error']);
     }
     $gallery->delete();
     $galleries = Auth::user()->galleries()->with('pictures')->get();
     return response()->json(['data' => $galleries->toArray()], 200);
 }