v0.10.18 - When deleting a menu, guide or event - The news according to the menu,guide or event will also get deleted (correctly now)

This commit is contained in:
Anders
2020-08-31 12:48:59 +02:00
parent 56cdd63fbb
commit b6f4fdb138
3 changed files with 16 additions and 10 deletions
@@ -193,7 +193,13 @@ class MenuPlanController extends Controller
*/
public function destroy($id)
{
// Find the menu you want to remove
$menuplan = MenuPlan::find($id);
// Find the news the you made when creating the menu (if there is a news)
$news = News::query()->join('news_types', 'news_types.id', '=', 'news.type_id')->where('type', '=', 'Menu')->where('arrangement_id', '=', $id);
//Delete the news or/and menu
$news->delete();
$menuplan->delete();
return redirect()->route("menu-plans.index");
}