Compare commits
2 Commits
779449d117
...
b15a823c9c
| Author | SHA1 | Date | |
|---|---|---|---|
| b15a823c9c | |||
|
|
dfb48055ea |
@@ -55,20 +55,6 @@ class VehicleController extends Controller
|
||||
], 404);
|
||||
}
|
||||
|
||||
// $expectedKeys = ['vehicle_number','entry_time','exit_time','duration','type'];
|
||||
|
||||
// $requestKeys = array_keys($request->all());
|
||||
|
||||
// sort($expectedKeys);
|
||||
// sort($requestKeys);
|
||||
|
||||
// if ($expectedKeys != $requestKeys) {
|
||||
// return response()->json([
|
||||
// 'status' => 'ERROR',
|
||||
// 'status_description' => 'Send proper valid JSON structure'
|
||||
// ], 400);
|
||||
// }
|
||||
|
||||
$plantId = $plantCod->id;
|
||||
|
||||
$data = $request->all();
|
||||
@@ -140,20 +126,27 @@ class VehicleController extends Controller
|
||||
], 404);
|
||||
}
|
||||
|
||||
$entryTime = $entryTimeRaw
|
||||
? Carbon::createFromFormat('d/m/Y h:i:s A', $entryTimeRaw)
|
||||
: null;
|
||||
if(!empty($entryTimeRaw)){
|
||||
$entryTime = $entryTimeRaw
|
||||
? Carbon::createFromFormat('d/m/Y h:i:s A', $entryTimeRaw)
|
||||
: null;
|
||||
}
|
||||
|
||||
$exitTime = $exitTimeRaw
|
||||
$exitTime = null;
|
||||
|
||||
if(!empty($exitTimeRaw)){
|
||||
|
||||
$exitTime = $exitTimeRaw
|
||||
? Carbon::createFromFormat('d/m/Y h:i:s A', $exitTimeRaw)
|
||||
: null;
|
||||
}
|
||||
|
||||
$record = VehicleEntry::insert([
|
||||
'plant_id' => $plantId,
|
||||
'vehicle_number' => $vehicleNo,
|
||||
'entry_time' => $entryTime,
|
||||
'exit_time' => $exitTime,
|
||||
'duration' => $duration,
|
||||
'exit_time' => $exitTime ?? null,
|
||||
'duration' => $duration ?: null,
|
||||
'type' => $type,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
|
||||
Reference in New Issue
Block a user