mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange.git
synced 2026-08-22 05:44:13 +00:00
added booking seeder
updated booking controller added test for booking
This commit is contained in:
@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Booking;
|
||||
use App\Rate;
|
||||
use App\User;
|
||||
|
||||
class BookingController extends Controller
|
||||
{
|
||||
@@ -63,11 +64,36 @@ class BookingController extends Controller
|
||||
$rate = "no";
|
||||
break;
|
||||
}
|
||||
return $rate;
|
||||
|
||||
|
||||
//Calculation part
|
||||
// $bookings = Booking::all();
|
||||
$amount = $request->input("amount");
|
||||
$svcharge=20.00;
|
||||
$bia = round(($amount + ($svcharge / $rate) + 0.06), 2);
|
||||
|
||||
// return $bia;
|
||||
$user = User::first();
|
||||
$booking = new Booking();
|
||||
$booking->account_name = $request->input('account_name');
|
||||
$booking->account_num = $request->input('account_num');
|
||||
$booking->bank_name = $request->input('bank_name');
|
||||
$booking->bank_branch = $request->input('bank_branch');
|
||||
$booking->company_name = $request->input('company_name');
|
||||
$booking->company_address = $request->input('company_address');
|
||||
$booking->bank_address = $request->input('bank_address');
|
||||
$booking->swift_code = $request->input('swift_code');
|
||||
$booking->cnap = $request->input('cnap');
|
||||
$booking->term = $request->input('term');
|
||||
$booking->amount = $request->input('amount');
|
||||
$booking->rate_id = $rate;
|
||||
// $booking->user()->associate($user);
|
||||
$booking->user_id = $request->input('user_id');
|
||||
$booking->bia = $bia;
|
||||
$booking->save();
|
||||
|
||||
// return false;
|
||||
//$booking = Booking::create($request->all());
|
||||
// return response()->json($booking, 201);
|
||||
return response()->json($booking, 201);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user