v0.9.4 - Added email notification when news gets added

This commit is contained in:
frederikpyt
2020-08-13 07:38:14 +02:00
parent 5c871c3fb7
commit aef8aa5d2c
5 changed files with 41 additions and 25 deletions
@@ -79,15 +79,15 @@ class MenuPlanController extends Controller
$news->name = "Ny menuplan";
$news->subname = "Uge " . $menuPlan->week;
$news->arrangement_id = $menuPlan->id;
$news->type_id = '2';
$news->content = $menuPlan->menu;
$news->type_id = '2';
$news->arrangement_id = $menuPlan->id;
if($request->file("resource")) {
$news->resource_id = ResourceController::store($request)->id;
}
$news->save();
NewsController::storeAndGet($news);
}
return redirect()->route("menu-plans.index", ['menuPlans' => $menuPlans]);
@@ -142,18 +142,15 @@ class MenuPlanController extends Controller
$menuPlans = MenuPlan::query()->paginate($request->input("limit", 20));
if($request->newsoption == true){
$news = [
"name" => "Opdateret menuplan",
"subname" => "Uge " . $menuplan->week,
"content" => $menuplan->menu
];
//Sæt ind i $news array'et
$news = new News();
$news->name = "Opdateret menuplan";
$news->subname = "Uge " . $menuplan->week;
$news->arrangement_id = $menuplan->id;
$news->type_id = '2';
$news->content = $menuplan->menu;
NewsController::storeAndGet($news);
}