mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange.git
synced 2026-08-22 22:04:17 +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.
|
||||
*
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class UserBankSlip extends Model
|
||||
{
|
||||
protected $fillable = ['bank_slip_type','bankslip_url','transfer_amount','book_id','cust_marking', 'is_approve'];
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
|
||||
$factory->define(App\UserBankSlip::class, function (Faker $faker) {
|
||||
return [
|
||||
//
|
||||
];
|
||||
});
|
||||
@@ -15,7 +15,7 @@ class CreateChinaBankSlipsTable extends Migration
|
||||
{
|
||||
Schema::create('china_bank_slips', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('bompany_name');
|
||||
$table->string('company_name');
|
||||
$table->string('bank_name');
|
||||
$table->string('acc_no');
|
||||
$table->string('bank_address');
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateUserBankSlipsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('user_bank_slips', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('bank_slip_type');
|
||||
$table->string('bankslip_url');
|
||||
$table->double('transfer_amount');
|
||||
$table->string('cust_marking');
|
||||
$table->boolean('is_approve');
|
||||
|
||||
$table->integer('book_id')->unsigned();
|
||||
$table->foreign('book_id')->references('id')->on('bookings');
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('user_bank_slips');
|
||||
}
|
||||
}
|
||||
@@ -80,3 +80,5 @@ Route::put('setting-supplier/{supplier}', 'SettingSupplierController@update');
|
||||
Route::delete('setting-supplier/{supplier}', 'SettingSupplierController@delete');
|
||||
|
||||
Route::post('upload-china-bankslip', 'ChinaBankSlipController@store');
|
||||
|
||||
Route::post('upload-bs', 'BookingController@uploadbankslip');
|
||||
|
||||
+1
-1
@@ -47,6 +47,7 @@ return array(
|
||||
'App\\SettingCredit' => $baseDir . '/app/SettingCredit.php',
|
||||
'App\\SettingSupplier' => $baseDir . '/app/SettingSupplier.php',
|
||||
'App\\User' => $baseDir . '/app/User.php',
|
||||
'App\\UserBankSlip' => $baseDir . '/app/UserBankSlip.php',
|
||||
'BookTableSeeder' => $baseDir . '/database/seeds/BookTableSeeder.php',
|
||||
'Carbon\\Carbon' => $vendorDir . '/nesbot/carbon/src/Carbon/Carbon.php',
|
||||
'Carbon\\CarbonInterval' => $vendorDir . '/nesbot/carbon/src/Carbon/CarbonInterval.php',
|
||||
@@ -3726,7 +3727,6 @@ return array(
|
||||
'Tests\\DuskTestCase' => $baseDir . '/tests/DuskTestCase.php',
|
||||
'Tests\\Feature\\LocaleTest' => $baseDir . '/tests/Feature/LocaleTest.php',
|
||||
'Tests\\Feature\\LoginTest' => $baseDir . '/tests/Feature/LoginTest.php',
|
||||
'Tests\\Feature\\OAuthTest' => $baseDir . '/tests/Feature/OAuthTest.php',
|
||||
'Tests\\Feature\\RegisterTest' => $baseDir . '/tests/Feature/RegisterTest.php',
|
||||
'Tests\\Feature\\SettingsTest' => $baseDir . '/tests/Feature/SettingsTest.php',
|
||||
'Tests\\TestCase' => $baseDir . '/tests/TestCase.php',
|
||||
|
||||
Vendored
+1
-1
@@ -446,6 +446,7 @@ class ComposerStaticInitebee75b176540aeb1d879b30f69e9dfc
|
||||
'App\\SettingCredit' => __DIR__ . '/../..' . '/app/SettingCredit.php',
|
||||
'App\\SettingSupplier' => __DIR__ . '/../..' . '/app/SettingSupplier.php',
|
||||
'App\\User' => __DIR__ . '/../..' . '/app/User.php',
|
||||
'App\\UserBankSlip' => __DIR__ . '/../..' . '/app/UserBankSlip.php',
|
||||
'BookTableSeeder' => __DIR__ . '/../..' . '/database/seeds/BookTableSeeder.php',
|
||||
'Carbon\\Carbon' => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon/Carbon.php',
|
||||
'Carbon\\CarbonInterval' => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon/CarbonInterval.php',
|
||||
@@ -4125,7 +4126,6 @@ class ComposerStaticInitebee75b176540aeb1d879b30f69e9dfc
|
||||
'Tests\\DuskTestCase' => __DIR__ . '/../..' . '/tests/DuskTestCase.php',
|
||||
'Tests\\Feature\\LocaleTest' => __DIR__ . '/../..' . '/tests/Feature/LocaleTest.php',
|
||||
'Tests\\Feature\\LoginTest' => __DIR__ . '/../..' . '/tests/Feature/LoginTest.php',
|
||||
'Tests\\Feature\\OAuthTest' => __DIR__ . '/../..' . '/tests/Feature/OAuthTest.php',
|
||||
'Tests\\Feature\\RegisterTest' => __DIR__ . '/../..' . '/tests/Feature/RegisterTest.php',
|
||||
'Tests\\Feature\\SettingsTest' => __DIR__ . '/../..' . '/tests/Feature/SettingsTest.php',
|
||||
'Tests\\TestCase' => __DIR__ . '/../..' . '/tests/TestCase.php',
|
||||
|
||||
Reference in New Issue
Block a user