TourController: Touren nach Datum sortieren (orderBy)

This commit is contained in:
tschneider 2021-02-11 10:34:05 +01:00
parent 9526e2f744
commit 60177901c6

View file

@ -23,7 +23,7 @@ class TourController extends Controller
public function index()
{
error_log("Tour:index");
$tours=Tour::where('start','>',Carbon::now())->get();
$tours=Tour::where('start','>',Carbon::now())->orderBy('start')->get();
$participantCount=array();
foreach($tours as $tour) {
$result = DB::select('select count(*) as cnt from bookings where tour_id=?', [$tour->id]);
@ -35,7 +35,7 @@ class TourController extends Controller
public function index_old()
{
error_log("Tour:index_old");
$tours=Tour::where('start','<',Carbon::now())->get();
$tours=Tour::where('start','<',Carbon::now())->orderBy('start')->get();
$participantCount=array();
foreach($tours as $tour) {
$result = DB::select('select count(*) as cnt from bookings where tour_id=?', [$tour->id]);