public function destroy($id) { PostCategory::destroy($id); $child_cats = PostCategory::where('parent_id', '=', $id)->get(); foreach ($child_cats as $cats) { $cats->parent_id = NULL; $cats->save(); } return Redirect::to('admin/posts/categories')->with(array('note' => 'Successfully Deleted Category', 'note_type' => 'success')); }