diff --git a/skolehjem/app/Http/Controllers/MenuPlanController.php b/skolehjem/app/Http/Controllers/MenuPlanController.php index 9a89fe6..15cd47e 100644 --- a/skolehjem/app/Http/Controllers/MenuPlanController.php +++ b/skolehjem/app/Http/Controllers/MenuPlanController.php @@ -41,6 +41,7 @@ class MenuPlanController extends Controller public function store(Request $request) { $requestMenuPlanCreate = $request->validate([ + "week" => "required|max:2", "monday" => "required|max:255", "tuesday" => "required|max:255", "wednesday" => "required|max:255", diff --git a/skolehjem/app/MenuPlan.php b/skolehjem/app/MenuPlan.php index cce1492..cef6c24 100644 --- a/skolehjem/app/MenuPlan.php +++ b/skolehjem/app/MenuPlan.php @@ -7,6 +7,6 @@ use Illuminate\Database\Eloquent\Model; class MenuPlan extends Model { protected $fillable = [ - 'monday', "tuesday", 'wednesday', 'thursday', "friday", "saturday", "sunday" + 'week', 'monday', "tuesday", 'wednesday', 'thursday' ]; } diff --git a/skolehjem/database/migrations/2020_06_23_070657_create_menu_plans.php b/skolehjem/database/migrations/2020_06_23_070657_create_menu_plans.php index 254328c..e60532f 100644 --- a/skolehjem/database/migrations/2020_06_23_070657_create_menu_plans.php +++ b/skolehjem/database/migrations/2020_06_23_070657_create_menu_plans.php @@ -15,6 +15,7 @@ class CreateMenuPlans extends Migration { Schema::create('menu_plans', function (Blueprint $table) { $table->id(); + $table->string('week', 2); $table->string('monday', 255); $table->string('tuesday', 255); $table->string('wednesday', 255); diff --git a/skolehjem/resources/views/admin/menuplans/create.blade.php b/skolehjem/resources/views/admin/menuplans/create.blade.php index 925a315..254f76e 100644 --- a/skolehjem/resources/views/admin/menuplans/create.blade.php +++ b/skolehjem/resources/views/admin/menuplans/create.blade.php @@ -13,6 +13,8 @@

Opret Menuplan:

@csrf + + diff --git a/skolehjem/resources/views/admin/menuplans/edit.blade.php b/skolehjem/resources/views/admin/menuplans/edit.blade.php index a8a8cc3..2cd747a 100644 --- a/skolehjem/resources/views/admin/menuplans/edit.blade.php +++ b/skolehjem/resources/views/admin/menuplans/edit.blade.php @@ -14,6 +14,8 @@ $menuplan ]) }}"> @csrf @method("PUT") + + @@ -23,6 +25,6 @@ - +
@endsection diff --git a/skolehjem/resources/views/admin/menuplans/index.blade.php b/skolehjem/resources/views/admin/menuplans/index.blade.php index 1ddbfbb..f5ceebf 100644 --- a/skolehjem/resources/views/admin/menuplans/index.blade.php +++ b/skolehjem/resources/views/admin/menuplans/index.blade.php @@ -12,6 +12,7 @@ @section("content") + @@ -21,6 +22,7 @@ @foreach($menuPlans as $menuplan) + diff --git a/skolehjem/resources/views/app/menuplans/index.blade.php b/skolehjem/resources/views/app/menuplans/index.blade.php index f66d484..3f4514a 100644 --- a/skolehjem/resources/views/app/menuplans/index.blade.php +++ b/skolehjem/resources/views/app/menuplans/index.blade.php @@ -5,26 +5,39 @@ @endsection @section("content") -
-

Menuplan

- Uge x -
-
-

Mandag

-

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc sodales pulvinar congue aenean suspendisse.

-
-
-

Tirsdag

-

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc sodales pulvinar congue aenean suspendisse.

-
-
-

Onsdag

-

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc sodales pulvinar congue aenean suspendisse.

-
-
-

Torsdag

-

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc sodales pulvinar congue aenean suspendisse.

-
-
+ +
+ @if($menuPlans->contains('week', $Week)) {{-- If any of the menues in the menu table has the number of the week in the 'week' column, do this --}} + @foreach($menuPlans as $menuplan) + @if($menuplan->week == $Week) +

Menuplan

+ Uge: {{$menuplan->week}} +
+
+

Mandag

+

{{$menuplan->monday}}

+
+
+

Tirsdag

+

{{$menuplan->tuesday}}

+
+
+

Onsdag

+

{{$menuplan->wednesday}}

+
+
+

Torsdag

+

{{$menuplan->thursday}}

+
+
+ @endif + @endforeach + @else +

Menuplan

+

Der er ingen menuplaner denne uge!

+ @endif
+ {{ $menuPlans->links() }} @endsection
Uge Mandag Tirsdag Onsdag
{{$menuplan->week}} {{$menuplan->monday}} {{$menuplan->tuesday}} {{$menuplan->wednesday}}