minor fixes

This commit is contained in:
Torsten Schneider 2021-03-06 11:19:57 +01:00
parent af73b49cfa
commit 60d74cc88d
3 changed files with 7 additions and 13 deletions

View file

@ -25,9 +25,11 @@ class TourController extends Controller
error_log("Tour:index");
$tours=Tour::where('start','>',Carbon::now())->orderBy('start')->get();
$participantCount=array();
foreach($tours as $tour) {
foreach($tours as $key => $tour) {
$result = DB::select('select count(*) as cnt from bookings where tour_id=?', [$tour->id]);
$participantCount[$tour->id] = $result[0]->cnt;
$tours[$key]->start=Tour::toGermanDate($tour->start);
$tours[$key]->deadline=Tour::toGermanDate($tour->deadline);
}
return view('tour.index')->with('tours',$tours)->with('participantCount',$participantCount);
}
@ -37,9 +39,11 @@ class TourController extends Controller
error_log("Tour:index_old");
$tours=Tour::where('start','<',Carbon::now())->orderBy('start')->get();
$participantCount=array();
foreach($tours as $tour) {
foreach($tours as $key => $tour) {
$result = DB::select('select count(*) as cnt from bookings where tour_id=?', [$tour->id]);
$participantCount[$tour->id] = $result[0]->cnt;
$tours[$key]->start=Tour::toGermanDate($tour->start);
$tours[$key]->deadline=Tour::toGermanDate($tour->deadline);
}
return view('tour.index_old')->with('tours',$tours)->with('participantCount',$participantCount);
}