mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange.git
synced 2026-08-19 12:24:09 +00:00
New Route for booking cancel. Fix bookingTest hardcoded link. Add Cancel function to bookingcontroller. Get Latest Rate for bookingController@store.
This commit is contained in:
@@ -17,7 +17,7 @@ class BookingController extends Controller
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$rates = Rate::all()->last();
|
||||
$rates = Rate::orderby('updated_at','desc')->first();
|
||||
$term = $request->input('term');
|
||||
$rate = 1; // default
|
||||
switch ($term) {
|
||||
@@ -129,7 +129,7 @@ class BookingController extends Controller
|
||||
public function uploadbankslip(Request $request, $id)
|
||||
{
|
||||
$booking = Booking::where('user_id',Auth::user()->id)->where('id',$id)->first();
|
||||
|
||||
|
||||
/* Validation*/
|
||||
if (!$booking)
|
||||
{
|
||||
@@ -175,7 +175,7 @@ class BookingController extends Controller
|
||||
|
||||
public function uploadPurchaseOrder(Request $request, $id)
|
||||
{
|
||||
$booking = Booking::where('user_id',Auth::user()->id)->where('id',$id)->first();
|
||||
$booking = Booking::where('user_id',Auth::user()->id)->where('id',$id)->first();
|
||||
|
||||
/* Validation */
|
||||
if (!$booking)
|
||||
@@ -198,13 +198,12 @@ class BookingController extends Controller
|
||||
}
|
||||
/* End Validation */
|
||||
|
||||
|
||||
$filename = $user_input_file->getClientOriginalName();
|
||||
$ext = $user_input_file->getClientOriginalExtension();
|
||||
|
||||
$input['image_url'] = $filename;
|
||||
$unique_name = 'purchase_order_' . md5($filename. time());
|
||||
$unique_image_url = $unique_name. '.' .$ext;
|
||||
$unique_image_url = $unique_name. '.' .$ext;
|
||||
Storage::putFileAs(
|
||||
'image_url',/*folder name*/ $user_input_file, $unique_image_url
|
||||
);
|
||||
@@ -217,6 +216,7 @@ class BookingController extends Controller
|
||||
|
||||
return response()->json(['message'=>'Success'],200);
|
||||
}
|
||||
|
||||
public function delete(Booking $book_id)
|
||||
{
|
||||
$booking = Booking::where('user_id', Auth::user())->where('id', $book_id)->firstOrFail();
|
||||
@@ -224,5 +224,16 @@ class BookingController extends Controller
|
||||
return response()->json($book_id, 204);
|
||||
}
|
||||
|
||||
// TODO : cancel booking feature
|
||||
public function cancel(Request $request, $book_id)
|
||||
{
|
||||
if (!$booking = Booking::where('user_id',Auth::user()->id)->where('id',$book_id)->first())
|
||||
{
|
||||
return response()->json(['message'=>'Access denied'], 200);
|
||||
}
|
||||
|
||||
$booking->is_cancel = true;
|
||||
$booking->save();
|
||||
|
||||
return response()->json(['message'=>'Success'],200);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user