mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange.git
synced 2026-08-19 12:24:09 +00:00
temporary added default amount value
fixed no file detected bug
This commit is contained in:
@@ -610,7 +610,7 @@ class BookingController extends Controller
|
||||
return response()->json(['message'=>'Image too large, upload files up to 3 MB'], 400);
|
||||
}
|
||||
|
||||
if(!$input_file = $request->file('invoice_path'))
|
||||
if(!$input_file = $request->file('file'))
|
||||
{
|
||||
return response()->json(['message'=>'No file detected'], 400);
|
||||
}
|
||||
@@ -619,16 +619,16 @@ class BookingController extends Controller
|
||||
$filename = $input_file->getClientOriginalName();
|
||||
$ext = $input_file->getClientOriginalExtension();
|
||||
|
||||
$input['invoice_path'] = $filename;
|
||||
$unique_name = 'invoice' . md5($filename. time());
|
||||
$unique_file_url = $unique_name. '.' .$ext;
|
||||
$upload_path = Storage::disk('public')->putFileAs(
|
||||
'invoice',/*folder name*/ $input_file, $unique_file_url, 'public'
|
||||
'invoice', $input_file, $unique_file_url, 'public'
|
||||
);
|
||||
|
||||
$invoice = new Invoice;
|
||||
$invoice->invoice_path = $upload_path;
|
||||
$invoice->amount = $request->input('amount');
|
||||
// TODO : amount
|
||||
$invoice->amount = 0;
|
||||
$invoice->booking_id = $booking->id;
|
||||
$invoice->save();
|
||||
|
||||
@@ -664,14 +664,14 @@ class BookingController extends Controller
|
||||
{
|
||||
$booking = Booking::where('id', $id)->firstOrFail();
|
||||
|
||||
$invoice = $booking->invoice()->first;
|
||||
$invoice = $booking->invoice()->first();
|
||||
|
||||
if(!$invoice){
|
||||
return response()->json(["message"=> "Please upload your invoice"],400);
|
||||
}
|
||||
|
||||
$booking->status = 7; // processing transfer
|
||||
$booking->admin_status = 6; // upload china bankslip
|
||||
$booking->status = 7; // completed
|
||||
$booking->admin_status = 7; // completed
|
||||
|
||||
if($booking->save()){
|
||||
return response()->json(['message'=>"Success"],200);
|
||||
|
||||
Reference in New Issue
Block a user