mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange.git
synced 2026-08-19 04:14:04 +00:00
customer booking bank slip
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\UserBankSlip;
|
||||
use App\User;
|
||||
use Auth;
|
||||
|
||||
@@ -124,9 +125,39 @@ class BookingController extends Controller
|
||||
// return false;
|
||||
//$booking = Booking::create($request->all());
|
||||
return response()->json($booking, 201);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function uploadbankslip(Request $request)
|
||||
{
|
||||
// Handle File Upload
|
||||
if($request->hasFile('bankslip_url')){
|
||||
// Get filename with the extension
|
||||
$filenameWithExt = $request->file('bankslip_url')->getClientOriginalName();
|
||||
// Get just filename
|
||||
$filename = pathinfo($filenameWithExt, PATHINFO_FILENAME);
|
||||
// Get just ext
|
||||
$extension = $request->file('bankslip_url')->getClientOriginalExtension();
|
||||
// Filename to store
|
||||
$fileNameToStore= $filename.'_'.time().'.'.$extension;
|
||||
// Upload Image
|
||||
$path = $request->file('bankslip_url')->storeAs('public/userbankslip', $fileNameToStore);
|
||||
} else {
|
||||
$fileNameToStore = 'hello.jpg';
|
||||
}
|
||||
// Create Post
|
||||
$post = new UserBankSlip;
|
||||
$post->bank_slip_type = $request->input('bank_slip_type');
|
||||
$post->transfer_amount = $request->input('transfer_amount');
|
||||
$post->book_id = $request->input('book_id');
|
||||
$post->cust_marking = $request->input('cust_marking');
|
||||
$post->is_approve = $request->input('is_approve');
|
||||
$post->bankslip_url = $fileNameToStore;
|
||||
$post->save();;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user