mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange.git
synced 2026-08-19 04:14:04 +00:00
update status to 7 on approve
This commit is contained in:
@@ -263,7 +263,7 @@ class InvoiceController extends Controller
|
||||
'comment' => Rule::requiredIf($request->status === 'request_change')
|
||||
]);
|
||||
|
||||
// Save to database
|
||||
// Save status to database
|
||||
|
||||
$status = new InvoiceStatuses;
|
||||
$status->status = $validatedData['status'];
|
||||
@@ -271,8 +271,23 @@ class InvoiceController extends Controller
|
||||
$status->invoice_id = Invoice::where('booking_id', $id)->first()['id'];
|
||||
$status->save();
|
||||
|
||||
// Response
|
||||
if(!$status) {
|
||||
return response()->json(['message' => 'Unable to Update Status'], 500);
|
||||
}
|
||||
|
||||
// Change Status to 7 if approve
|
||||
if ($validatedData['status'] === 'approve') {
|
||||
$booking = Booking::find($id);
|
||||
$booking->status = 7;
|
||||
$booking->admin_status = 7;
|
||||
$booking->save();
|
||||
|
||||
if(!$booking) {
|
||||
return response()->json(['message' => 'Unable to Complete Booking. Please Approve Again'], 500);
|
||||
}
|
||||
}
|
||||
|
||||
// Response
|
||||
return response()->json($status, 201);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user