/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy(Post $post) { $posts = Post::where('archive_id', $post->archive_id)->get(); if (sizeof($posts) <= 1) { $post->delete(); Archive::find($post->archive_id)->delete(); } else { $post->delete(); } }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { Archive::find($id)->delete(); return redirect('archives'); }