Fix/RegisterErrorMessage

This commit is contained in:
lonetrinity
2018-10-05 16:32:30 +08:00
parent 1ab9510e6e
commit af91e85efa
3 changed files with 95 additions and 60 deletions
+17 -26
View File
@@ -617,17 +617,7 @@ class BookingController extends Controller
// storing image in storage/app/public Folder
$upload_path = \Storage::disk('public')->put('user_bankslip'.'/'.$file_name, $data);
}
// /* End Validation */
// // $filename = $bankslip_file->getClientOriginalName();
//
// $unique_name = 'bank_slip_' . md5(time()); // probably not a good idea
// $unique_image_path = $unique_name. '.' .'jpg';
// $image_parts = explode(";base64,", $bankslip_file);
// $upload_path = \Storage::disk('public')->put('user_bankslip'.'/'.$unique_image_path,base64_decode(base64_decode($image_parts[1])));
// // $upload_path = Storage::disk('public')->putFileAs(
// // 'user_bankslip', base64_decode($image), $unique_image_path
// // );
if($upload_path){
$user_bankslip = $booking->userBankSlip()->first();
@@ -688,23 +678,23 @@ class BookingController extends Controller
return response()->json(['message'=>'Access denied'], 403);
}
$validator = Validator::make($request->all(), [
'file' => 'mimes:jpg,jpeg,bmp,png,xls,xlsx,doc,docx,pdf'
]);
// $validator = Validator::make($request->all(), [
// 'file' => 'mimes:jpg,jpeg,bmp,png,xls,xlsx,doc,docx,pdf'
// ]);
if($validator->fails())
{
return response()->json(['message'=>'Incorrect format'],400);
}
// if($validator->fails())
// {
// return response()->json(['message'=>'Incorrect format'],400);
// }
$validator = Validator::make($request->all(), [
'file' => 'max:10000'
]);
// $validator = Validator::make($request->all(), [
// 'file' => 'max:10000'
// ]);
if($validator->fails())
{
return response()->json(['message'=>'File too large, upload files up to 3 MB'], 400);
}
// if($validator->fails())
// {
// return response()->json(['message'=>'File too large, upload files up to 3 MB'], 400);
// }
if(!$user_input_file = $request->file('file'))
{
@@ -1011,7 +1001,8 @@ class BookingController extends Controller
}
}
public function confirmPurchaseOrder($id){
public function confirmPurchaseOrder($id, Request $request){
dd($request->input('images')[0]);
$booking = Booking::where('user_id',Auth::user()->id)->where('id',$id)->first();
$purchase_order = $booking->purchaseOrder()->first();