Conflicts:
	skolehjem/app/Http/Controllers/MenuPlanController.php
This commit is contained in:
frederikpyt
2020-08-12 15:28:15 +02:00
37 changed files with 582 additions and 244 deletions
@@ -2,10 +2,12 @@
namespace App\Http\Controllers;
use App;
use App\ExternalLink;
use App\MenuPlan;
use App\News;
use App\User;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\DB;
@@ -77,6 +79,8 @@ 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;
if($request->file("resource")) {
@@ -143,6 +147,12 @@ class MenuPlanController extends Controller
"subname" => "Uge " . $menuplan->week,
"content" => $menuplan->menu
];
//Sæt ind i $news array'et
$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);
}
@@ -156,7 +166,7 @@ class MenuPlanController extends Controller
* Remove the specified resource from storage.
* Test delete return index function.
* @param int $id
* @return \Illuminate\Http\RedirectResponse
* @return RedirectResponse
*/
public function destroy($id)
{
@@ -165,5 +175,19 @@ class MenuPlanController extends Controller
return redirect()->route("menu-plans.index");
}
/**
* Remove the specified resource from storage.
* Test delete return index function.
* @param $Id
* @return RedirectResponse
*/
public function genPDF($Id){
$menuPlan = MenuPlan::query()->where("id", "=", $Id)->first();
$pdf = \Illuminate\Support\Facades\App::make('dompdf.wrapper');
$data = '<div style="text-align: center">'. '<h1 style="font-size: 36px">Uge '. $menuPlan->week. '</h1>' .$menuPlan->menu. '</div>';
$pdf->loadHTML($data);
return $pdf->stream();
}
}