Fix of tour_rooms query 1/2; TourController is still inoperable.
This commit is contained in:
parent
9c04f88937
commit
78ebce3ba4
3 changed files with 271 additions and 34 deletions
|
|
@ -2,22 +2,29 @@
|
||||||
SELECT
|
SELECT
|
||||||
qry.tour_id,
|
qry.tour_id,
|
||||||
qry.room_id,
|
qry.room_id,
|
||||||
b.user_id,
|
u.id,
|
||||||
|
u.name,
|
||||||
qry.capacity,
|
qry.capacity,
|
||||||
qry.room_name,
|
|
||||||
COALESCE(qry.room_name,'Ungebucht') room_name,
|
COALESCE(qry.room_name,'Ungebucht') room_name,
|
||||||
COALESCE(qry.room_name,'ZZZZZZZZZ') room_sort_order
|
COALESCE(qry.room_name,'ZZZZZZZZZ') room_sort_order
|
||||||
FROM (
|
|
||||||
|
FROM
|
||||||
|
(
|
||||||
SELECT
|
SELECT
|
||||||
tr.tour_id,
|
tr.tour_id,
|
||||||
tr.id as room_id,
|
tr.id as room_id,
|
||||||
tr.capacity,
|
tr.capacity,
|
||||||
tr.name as room_name
|
tr.name as room_name,
|
||||||
|
b.user_id
|
||||||
FROM
|
FROM
|
||||||
tour_rooms tr
|
tour_rooms tr
|
||||||
|
LEFT JOIN bookings as b
|
||||||
|
ON b.tour_id = tr.tour_id AND b.room_id = tr.id
|
||||||
WHERE
|
WHERE
|
||||||
tr.tour_id= 17
|
tr.tour_id= 17
|
||||||
) qry LEFT JOIN bookings as b
|
) qry
|
||||||
ON b.tour_id = qry.tour_id AND b.room_id=qry.room_id
|
LEFT JOIN users as u
|
||||||
ORDER BY 6,4
|
ON qry.user_id = u.id
|
||||||
|
ORDER BY
|
||||||
|
qry.room_id
|
||||||
;
|
;
|
||||||
|
|
@ -149,24 +149,29 @@ class TourController extends Controller
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private function fetch_rooms($tour_id) {
|
private function fetch_rooms($tour_id) {
|
||||||
$sql="SELECT qry.tour_id,
|
// tour_room based display ( Suppresses users without room)
|
||||||
|
$sql="SELECT
|
||||||
|
qry.tour_id,
|
||||||
qry.room_id,
|
qry.room_id,
|
||||||
qry.user_id,
|
b.user_id,
|
||||||
qry.user_name,
|
qry.capacity,
|
||||||
COALESCE(br.name,'Ungebucht') room_name,
|
qry.room_name,
|
||||||
COALESCE(br.name,'ZZZZZZZZZ') room_sort_order
|
COALESCE(qry.room_name,'Ungebucht') room_name,
|
||||||
|
COALESCE(qry.room_name,'ZZZZZZZZZ') room_sort_order
|
||||||
FROM (
|
FROM (
|
||||||
SELECT
|
SELECT
|
||||||
bookings.tour_id,
|
tr.tour_id,
|
||||||
bookings.room_id as room_id,
|
tr.id as room_id,
|
||||||
bookings.user_id as user_id,
|
tr.capacity,
|
||||||
users.name as user_name
|
tr.name as room_name
|
||||||
FROM
|
FROM
|
||||||
bookings, users
|
tour_rooms tr
|
||||||
WHERE bookings.user_id = users.id AND bookings.tour_id = ".$tour_id."
|
WHERE
|
||||||
) qry LEFT JOIN booking_rooms as br
|
tr.tour_id= ".$tour_id."
|
||||||
ON br.id = qry.room_id
|
) qry LEFT JOIN bookings as b
|
||||||
ORDER BY 6,4;";
|
ON b.tour_id = qry.tour_id AND b.room_id=qry.room_id
|
||||||
|
ORDER BY 6,4
|
||||||
|
;";
|
||||||
|
|
||||||
$rooms=DB::select($sql);
|
$rooms=DB::select($sql);
|
||||||
return($rooms);
|
return($rooms);
|
||||||
|
|
@ -248,11 +253,11 @@ class TourController extends Controller
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
public function create_room($tour_id, $capacity) {
|
public function create_room($tour_id, $capacity) {
|
||||||
DB::delete("INSERT INTO booking_rooms")
|
DB::delete("INSERT INTO booking_rooms")
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
public function upload_gallery(Request $request, Tour $tour){
|
public function upload_gallery(Request $request, Tour $tour){
|
||||||
dd($request);
|
dd($request);
|
||||||
|
|
|
||||||
225
tools/motorradig_2022-05-10_083921.sql
Normal file
225
tools/motorradig_2022-05-10_083921.sql
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue