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