diff --git a/motorradig/app/Http/Controllers/BookingController.php b/motorradig/app/Http/Controllers/BookingController.php deleted file mode 100644 index 078761c..0000000 --- a/motorradig/app/Http/Controllers/BookingController.php +++ /dev/null @@ -1,85 +0,0 @@ -with('tours',$tours); } + + public function index_bookings($tour_id) + { + $tour=Tour::find($tour_id); + $bookings=array(); + foreach($tour->getBookings($tour_id) as $booking) { + array_push($bookings,$booking); + } + error_log("Tour:index_bookings, tour_id=".$tour->id); + return view('tour.index_bookings')->with('tour',$tour)->with('bookings',$bookings); + } + + /** * Show the form for creating a new resource. * diff --git a/motorradig/app/Tour.php b/motorradig/app/Tour.php index 794b9e1..197f33b 100644 --- a/motorradig/app/Tour.php +++ b/motorradig/app/Tour.php @@ -9,4 +9,10 @@ class Tour extends Model protected $fillable = [ 'id', 'name', 'beschreibung','user_id','start','deadline' ]; + + public static function getBookings($tour_id) { + error_log("getBookings for tour_id: ".$tour_id); + $bookings=Booking::where('tour_id',$tour_id)->get(); + return $bookings; + } } diff --git a/motorradig/resources/views/tour/index_bookings.blade.php b/motorradig/resources/views/tour/index_bookings.blade.php new file mode 100644 index 0000000..c3b3743 --- /dev/null +++ b/motorradig/resources/views/tour/index_bookings.blade.php @@ -0,0 +1,31 @@ +@extends('layouts.app') + +@section('content') +
+

Teilnehmer

+ +
+ . + + + + +
+ @if(Auth::user()->role=="ADMIN" or Auth::user()->rolde=="MEMBER") +
+ Neue Tour anlegen +
+ @endif + +
+@endsection diff --git a/motorradig/resources/views/tour/show.blade.php b/motorradig/resources/views/tour/show.blade.php index f131f43..27f3d93 100644 --- a/motorradig/resources/views/tour/show.blade.php +++ b/motorradig/resources/views/tour/show.blade.php @@ -47,6 +47,10 @@ +
+ + {{ old('max_participants') ?? count(\App\Tour::getBookings($tour->id)) }} +