|
|
|
|
@ -220,10 +220,13 @@ class OrdersController extends CommonController
|
|
|
|
|
}
|
|
|
|
|
})->where('admin_id', $user->id)->pluck('area_id');
|
|
|
|
|
}
|
|
|
|
|
$data = Area::where(function ($query) use ($areaId) {
|
|
|
|
|
$data = Area::where(function ($query) use ($areaId, $request) {
|
|
|
|
|
if ($areaId) {
|
|
|
|
|
$query->whereIn('id', $areaId);
|
|
|
|
|
}
|
|
|
|
|
if ($request->project_id) {
|
|
|
|
|
$query->where('project_id', $request->project_id);
|
|
|
|
|
}
|
|
|
|
|
})->with([
|
|
|
|
|
"beds" => function ($query) use ($request) {
|
|
|
|
|
if ($request->has_ongoing_order) {
|
|
|
|
|
@ -237,8 +240,7 @@ class OrdersController extends CommonController
|
|
|
|
|
->addSelect("room.name as room_name")
|
|
|
|
|
->orderBy("room.name")
|
|
|
|
|
->orderBy("bed.name");
|
|
|
|
|
}])->whereRaw("`area`.`project_id` = '{$request->project_id}'")
|
|
|
|
|
->orderBy("building.myindex")
|
|
|
|
|
}])->orderBy("building.myindex")
|
|
|
|
|
->orderBy("area1.myindex")
|
|
|
|
|
->select("area.id", "area.name", "area.building_id", "area.project_id")
|
|
|
|
|
->leftJoin("building", "area.building_id", "=", "building.id")
|
|
|
|
|
|