customer booking bank slip

This commit is contained in:
Nazri
2018-05-28 10:58:40 +08:00
parent 54f79b74dc
commit 5c1a4d28c4
8 changed files with 95 additions and 3 deletions
@@ -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.
*