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:
@@ -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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user