master
parent
97b31e4a3b
commit
54b4271312
|
|
@ -154,16 +154,22 @@ class MobileApiController extends Controller
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$applications = [];
|
$status = $request->query('status');
|
||||||
$application = UniModel::model('pipi_applications')->where('user_id', $user->id)->get();
|
|
||||||
foreach ($application as $app) {
|
$data = [];
|
||||||
|
$query = UniModel::model('pipi_applications')->where('user_id', $user->id);
|
||||||
|
if (isset($status)) {
|
||||||
|
$query->where('status', $status);
|
||||||
|
}
|
||||||
|
$applications = $query->get();
|
||||||
|
foreach ($applications as $app) {
|
||||||
$car = UniModel::model('pipi_auto')->find($app->car_id);
|
$car = UniModel::model('pipi_auto')->find($app->car_id);
|
||||||
$model = UniModel::model('pipi_brand_models')->find($car->model_id);
|
$model = UniModel::model('pipi_brand_models')->find($car->model_id);
|
||||||
$photo = UniModel::model('core_files')->find($model->photo_id);
|
$photo = UniModel::model('core_files')->find($model->photo_id);
|
||||||
$photo = url('api/files/file/' . ltrim($photo?->path, '/'));
|
$photo = url('api/files/file/' . ltrim($photo?->path, '/'));
|
||||||
$class_id = UniModel::model('pipi_auto_classes')->where('id', $model->class_id)->first();
|
$class_id = UniModel::model('pipi_auto_classes')->where('id', $model->class_id)->first();
|
||||||
$bodywork_id = UniModel::model('pipi_auto_bodywork')->where('id', $model->bodywork_id)->first();
|
$bodywork_id = UniModel::model('pipi_auto_bodywork')->where('id', $model->bodywork_id)->first();
|
||||||
$applications[] = [
|
$data[] = [
|
||||||
'id' => $app->id,
|
'id' => $app->id,
|
||||||
'rent_day' => $app->rent_day,
|
'rent_day' => $app->rent_day,
|
||||||
'started_at' => $app->started_at,
|
'started_at' => $app->started_at,
|
||||||
|
|
@ -186,10 +192,10 @@ class MobileApiController extends Controller
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
if (empty($applications)) {
|
if (empty($data)) {
|
||||||
$applications = (object) $applications;
|
$data = (object) $data;
|
||||||
}
|
}
|
||||||
return response()->json($applications);
|
return response()->json($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function login(Request $request)
|
public function login(Request $request)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue