fixBankInSlip

This commit is contained in:
lonetrinity
2018-09-12 15:36:49 +08:00
commit ced8c02203
363 changed files with 41654 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
<?php
use Faker\Generator as Faker;
$factory->define(App\Booking::class, function (Faker $faker) {
$rate_id = App\Rate::pluck('id')->toArray();
$user_id = App\User::pluck('id')->toArray();
return [
'account_name' => $faker->name,
'account_num' => $faker->unique()->randomDigit,
'bank_name' => $faker->name,
'bank_branch' => $faker->unique()->address,
'company_name' => $faker->name,
'company_address' => $faker->unique()->address,
'bank_address' => $faker->unique()->address,
'swift_code' => $faker->unique()->randomDigit,
'cnap' => $faker->randomDigit,
'term' => str_random(10),
'amount'=> $faker->randomDigit,
'rate_id' => $faker->randomElement($rate_id),
'user_id' => $faker->randomElement($user_id),
'rmb_book_amount' => $faker->randomDigit,
'rmb_book_pay_method' => str_random(10),
'rmb_book_account_name' => $faker->name,
'rmb_book_acc_no' => $faker->randomDigit,
'rmb_book_bank_branch' => $faker->unique()->address,
'usd_book_amount' => $faker->randomDigit,
'usd_book_pay_method'=> str_random(10),
'usd_book_company_name'=> $faker->name,
'usd_book_company_address' => $faker->unique()->address,
'usd_book_swift_code'=> $faker->unique()->randomDigit,
'usd_book_cnap' => $faker->randomDigit,
'usd_book_bank_branch' => $faker->unique()->address,
];
});
@@ -0,0 +1,9 @@
<?php
use Faker\Generator as Faker;
$factory->define(App\ChinaBankSlip::class, function (Faker $faker) {
return [
//
];
});
+10
View File
@@ -0,0 +1,10 @@
<?php
use Faker\Generator as Faker;
$factory->define(App\Marking::class, function (Faker $faker) {
return [
'email' => $faker->unique()->safeEmail,
'marking' => strtoupper(str_random(5))
];
});
@@ -0,0 +1,9 @@
<?php
use Faker\Generator as Faker;
$factory->define(App\PurchaseOrder::class, function (Faker $faker) {
return [
//
];
});
+14
View File
@@ -0,0 +1,14 @@
<?php
use Faker\Generator as Faker;
$factory->define(App\Rate::class, function (Faker $faker) {
return [
'x1_cash' => $faker->randomDigit,
'x1_cheque' => $faker->randomDigit,
'x1_ba' => $faker->randomDigit,
'x2_cash' => $faker->randomDigit,
'x2_cheque' => $faker->randomDigit,
'x2_ba' => $faker->randomDigit
];
});
@@ -0,0 +1,9 @@
<?php
use Faker\Generator as Faker;
$factory->define(Model::class, function (Faker $faker) {
return [
//
];
});
@@ -0,0 +1,9 @@
<?php
use Faker\Generator as Faker;
$factory->define(App\SettingBeneficiary::class, function (Faker $faker) {
return [
//
];
});
@@ -0,0 +1,11 @@
<?php
use Faker\Generator as Faker;
$factory->define(App\SettingCredit::class, function (Faker $faker) {
return [
'rmb_credit_limit' => $faker->randomDigit,
'usd_credit_limit' => $faker->randomDigit,
'time_limit' => $faker->randomDigit
];
});
@@ -0,0 +1,9 @@
<?php
use Faker\Generator as Faker;
$factory->define(Model::class, function (Faker $faker) {
return [
//
];
});
@@ -0,0 +1,13 @@
<?php
use Faker\Generator as Faker;
$factory->define(App\SettingSupplier::class, function (Faker $faker) {
return [
'company_name' => $faker->name,
'gst_no' => $faker->unique()->randomDigit,
'supplier_reg_no' => $faker->unique()->randomDigit,
'bank_name' => $faker->name,
'acc_no' => $faker->unique()->randomDigit
];
});
@@ -0,0 +1,9 @@
<?php
use Faker\Generator as Faker;
$factory->define(App\SupplierBookingItem::class, function (Faker $faker) {
return [
//
];
});
@@ -0,0 +1,15 @@
<?php
use Faker\Generator as Faker;
$factory->define(App\UserBankSlip::class, function (Faker $faker) {
$book_id = App\Booking::pluck('id')->toArray();
return [
'bank_slip_type' => str_random(10),
'bankslip_path' => str_random(10),
'transfer_amount' => $faker->randomDigit,
'cust_marking' => str_random(10),
'booking_id' => $faker->randomElement($book_id),
];
});
+26
View File
@@ -0,0 +1,26 @@
<?php
use Faker\Generator as Faker;
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| This directory should contain each of the model factory definitions for
| your application. Factories provide a convenient way to generate new
| model instances for testing / seeding your application's database.
|
*/
$factory->define(App\User::class, function (Faker $faker) {
static $password;
return [
'name' => $faker->name,
'email' => $faker->unique()->safeEmail,
'password' => $password ?: $password = bcrypt('secret'),
'remember_token' => str_random(10),
'marking' => $faker->name,
];
});
@@ -0,0 +1,35 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('email')->unique();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('users');
}
}
@@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePasswordResetsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('password_resets', function (Blueprint $table) {
$table->string('email')->index();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('password_resets');
}
}
@@ -0,0 +1,41 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateOauthProvidersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('oauth_providers', function (Blueprint $table) {
$table->increments('id');
$table->integer('user_id')->unsigned();
$table->string('provider');
$table->string('provider_user_id')->index();
$table->string('access_token')->nullable();
$table->string('refresh_token')->nullable();
$table->timestamps();
$table->foreign('user_id')
->references('id')
->on('users')
->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('oauth_providers');
}
}
@@ -0,0 +1,37 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateRatesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('rates', function (Blueprint $table) {
$table->increments('id');
$table->double('x1_cash');
$table->double('x1_cheque');
$table->double('x1_ba');
$table->double('x2_cash');
$table->double('x2_cheque');
$table->double('x2_ba');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('rates');
}
}
@@ -0,0 +1,33 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateSettingCreditsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('setting_credits', function (Blueprint $table) {
$table->increments('id');
$table->decimal('rmb_credit_limit');
$table->decimal('usd_credit_limit');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('setting_credits');
}
}
@@ -0,0 +1,36 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateSettingSuppliersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('setting_suppliers', function (Blueprint $table) {
$table->increments('id');
$table->string('company_name');
$table->string('gst_no');
$table->string('supplier_reg_no')->nullable();
$table->string('bank_name');
$table->string('acc_no');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('setting_suppliers');
}
}
@@ -0,0 +1,38 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateSettingBeneficiariesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('setting_beneficiaries', function (Blueprint $table) {
$table->increments('id');
$table->string('company_name');
$table->string('bank_name');
$table->string('acc_no')->unique();
$table->string('bank_address');
$table->string('swift');
$table->string('cnap');
$table->string('bank_branch');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('setting_beneficiaries');
}
}
@@ -0,0 +1,75 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class EntrustSetupTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
DB::beginTransaction();
// Create table for storing roles
Schema::create('roles', function (Blueprint $table) {
$table->increments('id');
$table->string('name')->unique();
$table->string('display_name')->nullable();
$table->string('description')->nullable();
$table->timestamps();
});
// Create table for associating roles to users (Many-to-Many)
Schema::create('role_user', function (Blueprint $table) {
$table->integer('user_id')->unsigned();
$table->integer('role_id')->unsigned();
$table->foreign('user_id')->references('id')->on('users')
->onUpdate('cascade')->onDelete('cascade');
$table->foreign('role_id')->references('id')->on('roles')
->onUpdate('cascade')->onDelete('cascade');
$table->primary(['user_id', 'role_id']);
});
// Create table for storing permissions
Schema::create('permissions', function (Blueprint $table) {
$table->increments('id');
$table->string('name')->unique();
$table->string('display_name')->nullable();
$table->string('description')->nullable();
$table->timestamps();
});
// Create table for associating permissions to roles (Many-to-Many)
Schema::create('permission_role', function (Blueprint $table) {
$table->integer('permission_id')->unsigned();
$table->integer('role_id')->unsigned();
$table->foreign('permission_id')->references('id')->on('permissions')
->onUpdate('cascade')->onDelete('cascade');
$table->foreign('role_id')->references('id')->on('roles')
->onUpdate('cascade')->onDelete('cascade');
$table->primary(['permission_id', 'role_id']);
});
DB::commit();
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('permission_role');
Schema::drop('permissions');
Schema::drop('role_user');
Schema::drop('roles');
}
}
@@ -0,0 +1,44 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateChinaBankSlipsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('china_bank_slips', function (Blueprint $table) {
$table->increments('id');
$table->string('company_name');
$table->string('bank_name');
$table->string('acc_no');
$table->string('bank_address');
$table->string('swift');
$table->string('cnap');
$table->string('bank_branch');
$table->string('order_id');
$table->double('transfer_amount_needed');
$table->double('actual_transfer_amount');
$table->string('date');
$table->string('details');
$table->string('bankslip_url');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('china_bank_slips');
}
}
@@ -0,0 +1,54 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateBookingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('bookings', function (Blueprint $table) {
$table->increments('id');
$table->string('account_name');
$table->integer('account_num');
$table->string('bank_name');
$table->string('bank_branch');
$table->string('company_name');
$table->string('company_address');
$table->string('bank_address');
$table->string('swift_code');
$table->string('cnap');
$table->string('term');
$table->double('amount');
$table->unsignedInteger('rate_id');
$table->foreign('rate_id')
->references('id')->on('rates')
->onDelete('cascade');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('bookings', function(Blueprint $table)
{
$table->dropForeign('bookings_rate_id_foreign');
$table->dropColumn('rate_id');
});
Schema::dropIfExists('bookings');
}
}
@@ -0,0 +1,38 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class ChangeUserIdInBookingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('bookings', function (Blueprint $table) {
$table->unsignedInteger('user_id')->default('0');
$table->foreign('user_id')
->references('id')->on('users')
->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('bookings', function(Blueprint $table)
{
$table->dropForeign('bookings_user_id_foreign');
$table->dropColumn('user_id');
});
}
}
@@ -0,0 +1,30 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddBiaInBookingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('bookings', function (Blueprint $table) {
$table->double('bia')->default('0');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -0,0 +1,44 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddBookingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('bookings', function (Blueprint $table) {
$table->double('rmb_book_amount')->default('0');
$table->string('rmb_book_pay_method')->default(' ');
$table->string('rmb_book_account_name')->default(' ');
$table->string('rmb_book_bank_name')->default(' ');
$table->string('rmb_book_acc_no')->default(' ');
$table->string('rmb_book_bank_branch')->default(' ');
$table->double('usd_book_amount')->default('0');
$table->string('usd_book_pay_method')->default(' ');
$table->string('usd_book_company_name')->default(' ');
$table->string('usd_book_company_address')->default(' ');
$table->string('usd_book_swift_code')->default(' ');
$table->string('usd_book_cnap')->default(' ');
$table->string('usd_book_bank_branch')->default(' ');
$table->boolean('verification_status')->default('1');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
}
@@ -0,0 +1,46 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class MakeNullableFieldBookingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('bookings', function (Blueprint $table) {
$table->decimal('rmb_book_amount',9,3)->nullable()->change();
$table->string('rmb_book_pay_method')->nullable()->change();
$table->string('rmb_book_account_name')->nullable()->change();
$table->string('rmb_book_bank_name')->nullable()->change();
$table->string('rmb_book_acc_no')->nullable()->change();
$table->string('rmb_book_bank_branch')->nullable()->change();
$table->decimal('usd_book_amount', 9,3)->nullable()->change();
$table->string('usd_book_pay_method')->nullable()->change();
$table->string('usd_book_company_name')->nullable()->change();
$table->string('usd_book_company_address')->nullable()->change();
$table->string('usd_book_swift_code')->nullable()->change();
$table->string('usd_book_cnap')->nullable()->change();
$table->string('usd_book_bank_branch')->nullable()->change();
$table->boolean('verification_status')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('bookings', function (Blueprint $table) {
//
});
}
}
@@ -0,0 +1,43 @@
<?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')->nullable();
$table->string('bankslip_url')->nullable();
$table->double('transfer_amount')->nullable();
$table->string('cust_marking')->nullable();
$table->integer('book_id')->unsigned();
$table->foreign('book_id')->references('id')->on('bookings');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('user_bank_slips', function(Blueprint $table)
{
$table->dropForeign('user_bank_slips_book_id_foreign');
});
Schema::dropIfExists('user_bank_slips');
}
}
@@ -0,0 +1,40 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePurchaseOrdersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('purchase_orders', function (Blueprint $table) {
$table->increments('id');
$table->string('image_url');
$table->double('amount');
$table->integer('book_id')->unsigned()->nullable;
$table->foreign('book_id')->references('id')->on('bookings');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('purchase_orders', function(Blueprint $table)
{
$table->dropForeign('purchase_orders_booking_id_foreign');
$table->dropColumn('booking_id');
});
Schema::dropIfExists('purchase_orders');
}
}
@@ -0,0 +1,31 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class UpdateUploadBookingBankslip extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('user_bank_slips', function (Blueprint $table) {
$table->boolean('is_approve')->default('0');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('user_bank_slips', function (Blueprint $table) {
//
});
}
}
@@ -0,0 +1,34 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddCancelBookingTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('bookings', function (Blueprint $table) {
$table->boolean('is_cancel')->default('0');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
if (Schema::hasColumn('bookings', 'is_cancel')) {
Schema::table('bookings', function (Blueprint $table) {
// $table->dropColumn('is_cancel');
});
}
}
}
@@ -0,0 +1,36 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddRejectUserBankSlipTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('user_bank_slips', function (Blueprint $table) {
$table->boolean('is_reject')->default('0');
$table->string('reject_reason')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
if (Schema::hasColumn('user_bank_slips', 'is_reject')) {
Schema::table('user_bank_slips', function (Blueprint $table) {
// $table->dropColumn('is_reject');
// $table->dropColumn('reject_reason');
});
}
}
}
@@ -0,0 +1,31 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class RenameBookIdToBookingIdInUserbankslipTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('user_bank_slips', function($table)
{
$table->renameColumn('book_id', 'booking_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -0,0 +1,33 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateMarkingTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('markings', function (Blueprint $table) {
$table->increments('id');
$table->string('email')->unique();
$table->string('marking')->unique();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('markings');
}
}
@@ -0,0 +1,33 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddRateToBooking extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('bookings', function (Blueprint $table) {
$table->double('rate')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('bookings', function (Blueprint $table) {
$table->dropColumn('rate');
// $table->dropColumn('reject_reason');
});
}
}
@@ -0,0 +1,33 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddStatusToBookingTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('bookings', function (Blueprint $table) {
$table->integer('status')->default(1);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('bookings', function (Blueprint $table) {
$table->dropColumn('status');
// $table->dropColumn('reject_reason');
});
}
}
@@ -0,0 +1,44 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class SupplierBookingTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('supplier_bookings', function (Blueprint $table) {
$table->increments('id');
$table->string('payment_method');
$table->double('transfer_amount');
$table->double('rate');
$table->double('rebate');
$table->double('amountInRMB');
$table->double('rmbBankAmount');
$table->integer('book_id')->unsigned();
$table->foreign('book_id')->references('id')->on('bookings');
$table->integer('supplier_id')->unsigned();
$table->foreign('supplier_id')->references('id')->on('setting_suppliers');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('supplier_bookings');
}
}
@@ -0,0 +1,34 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class SupplierbookingCustomerbookingTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('supplierbooking_customerbooking', function (Blueprint $table) {
$table->integer('supplierbooking_id')->unsigned();
$table->integer('booking_id')->unsigned();
$table->foreign('supplierbooking_id')->references('id')->on('supplier_bookings');
$table->foreign('booking_id')->references('id')->on('bookings');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('supplierbooking_customerbooking');
}
}
@@ -0,0 +1,41 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateInvoiceTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('invoices', function (Blueprint $table) {
$table->increments('id');
$table->string('invoice_path');
$table->double('amount');
$table->integer('booking_id')->unsigned();
$table->foreign('booking_id')->references('id')->on('bookings');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('invoices', function(Blueprint $table)
{
$table->dropForeign('invoices_booking_id_foreign');
$table->dropColumn('booking_id');
});
Schema::dropIfExists('invoices');
}
}
@@ -0,0 +1,31 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class RenameImageurlToImagepathInUserbankslipsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('user_bank_slips', function($table)
{
$table->renameColumn('bankslip_url', 'bankslip_path');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -0,0 +1,31 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class RenameImageurlToImagepathInPurchaseordersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('purchase_orders', function($table)
{
$table->renameColumn('image_url', 'image_path');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -0,0 +1,34 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class RemoveAmountcolumnFromPoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('purchase_orders', function (Blueprint $table) {
$table->dropColumn('amount');
// $table->dropColumn('reject_reason');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('purchase_orders', function (Blueprint $table) {
$table->double('amount');
// $table->dropColumn('reject_reason');
});
}
}
@@ -0,0 +1,33 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddAdminstatusToBookingTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('bookings', function (Blueprint $table) {
$table->integer('admin_status')->default(1);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('bookings', function (Blueprint $table) {
$table->dropColumn('admin_status');
// $table->dropColumn('reject_reason');
});
}
}
@@ -0,0 +1,29 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class ChangeAdminstatusDefaultBookingTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('bookings', function (Blueprint $table) {
$table->integer('admin_status')->default(0)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
}
@@ -0,0 +1,30 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class ChangeAdminstatusDefaultTo1OnBookingTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('bookings', function (Blueprint $table) {
$table->integer('admin_status')->default(1)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddTimeLimitSettingCreditTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('setting_credits', function (Blueprint $table) {
$table->integer('time_limit')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('setting_credits', function (Blueprint $table) {
$table->dropColumn('time_limit');
});
}
}
@@ -0,0 +1,37 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateSupplierBookingItemsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('supplier_booking_items', function (Blueprint $table) {
$table->increments('id');
$table->string('china_bankslip_url');
$table->integer('book_id')->unsigned();
$table->foreign('book_id')->references('id')->on('bookings');
$table->double('bank_in_amount');
$table->integer('supplierbooking_id')->unsigned();
$table->foreign('supplierbooking_id')->references('id')->on('supplier_bookings');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('supplier_booking_items');
}
}
@@ -0,0 +1,34 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddEtaUserBankSlipTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('user_bank_slips', function (Blueprint $table) {
$table->integer('estimated_arrival_time')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
if (Schema::hasColumn('user_bank_slips', 'estimated_arrival_time')) {
Schema::table('user_bank_slips', function (Blueprint $table) {
$table->dropColumn('estimated_arrival_time');
});
}
}
}
@@ -0,0 +1,31 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class RenameBankslipUrlToChinabanksliPathInChinaBankSlipTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('china_bank_slips', function($table)
{
$table->renameColumn('bankslip_url', 'china_bank_slip_path');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -0,0 +1,31 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class MakePaymentmethodNulltableInSupplierbookingTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('supplier_bookings', function($table)
{
$table->string('payment_method')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -0,0 +1,36 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddBookingidForeignkeyToChinabankslipTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('china_bank_slips', function($table)
{
$table->integer('booking_id')->unsigned()->nullable();
$table->foreign('booking_id')->references('id')->on('bookings');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('china_bank_slips', function(Blueprint $table)
{
$table->dropForeign('china_bank_slips_booking_id_foreign');
$table->dropColumn('booking_id');
});
}
}
@@ -0,0 +1,34 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class RenameBookingForeignkeyInPoTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('purchase_orders', function($table)
{
$table->dropForeign(['book_id']);
$table->dropColumn('book_id');
$table->integer('booking_id')->unsigned()->nullable();
$table->foreign('booking_id')->references('id')->on('bookings');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class RemoveUserInUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('name');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->string('name');
});
}
}
@@ -0,0 +1,34 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class RenameBookingForeignkeyFromSupplierbookingTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('supplier_bookings', function($table)
{
$table->dropForeign(['book_id']);
$table->dropColumn('book_id');
$table->integer('booking_id')->unsigned()->nullable();
$table->foreign('booking_id')->references('id')->on('bookings');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -0,0 +1,30 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddBillingFieldToSupplierbookingTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('supplier_bookings', function($table)
{
$table->double('billing_amount')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
}
@@ -0,0 +1,33 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddSalestaxFieldToSupplierbookingTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('supplier_bookings', function($table)
{
$table->double('salestax_amount')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('supplier_bookings', function (Blueprint $table) {
$table->dropColumn('salestax_amount');
});
}
}
@@ -0,0 +1,34 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddNameInUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function($table)
{
$table->string('name')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('name');
});
}
}
@@ -0,0 +1,31 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class UpdateNameToNullableInUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function($table)
{
$table->string('name')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -0,0 +1,34 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddMarkingToUserTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function($table)
{
$table->string('marking')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('marking');
});
}
}
@@ -0,0 +1,38 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateSettingMalaysiaBankTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('setting_malaysia_banks', function (Blueprint $table) {
$table->increments('id');
$table->string('company_name');
$table->string('bank_name');
$table->string('acc_no')->unique();
$table->string('bank_address');
$table->string('swift');
$table->string('cnap');
$table->string('bank_branch');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('setting_malaysia_banks');
}
}
@@ -0,0 +1,36 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddNullableSettingMalaysiaBankTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('setting_malaysia_banks', function(Blueprint $table) {
$table->string('company_name')->nullable()->change();
$table->string('bank_name')->nullable()->change();
$table->string('acc_no')->nullable()->change();
$table->string('bank_address')->nullable()->change();
$table->string('swift')->nullable()->change();
$table->string('cnap')->nullable()->change();
$table->string('bank_branch')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -0,0 +1,43 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateSettingActiveBankTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('setting_active_banks', function (Blueprint $table) {
$table->increments('id');
$table->string('x1_bank_id')->unique();
$table->string('x2_bank_id')->unique();
$table->string('beneficiary_id')->nullable();
$table->foreign('x1_bank_id')
->references('acc_no')->on('setting_malaysia_banks')
->onDelete('cascade');
$table->foreign('x2_bank_id')
->references('acc_no')->on('setting_malaysia_banks')
->onDelete('cascade');
$table->foreign('beneficiary_id')
->references('acc_no')->on('setting_beneficiaries')
->onDelete('cascade');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('setting_active_banks');
}
}
@@ -0,0 +1,41 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class ChangeForeignkeyTypeInActivebankTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('setting_active_banks', function(Blueprint $table)
{
$table->dropForeign('setting_active_banks_x1_bank_id_foreign');
$table->foreign('x1_bank_id')
->references('acc_no')->on('setting_malaysia_banks');
$table->dropForeign('setting_active_banks_x2_bank_id_foreign');
$table->foreign('x2_bank_id')
->references('acc_no')->on('setting_malaysia_banks');
$table->dropForeign('setting_active_banks_beneficiary_id_foreign');
$table->foreign('beneficiary_id')
->references('acc_no')->on('setting_beneficiaries');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -0,0 +1,36 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddNotNullableSettingMalaysiaBankTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('setting_malaysia_banks', function(Blueprint $table) {
$table->string('company_name')->nullable(false)->change();
$table->string('bank_name')->nullable(false)->change();
$table->string('acc_no')->nullable()->change(); // reference key at select active bank
$table->string('bank_address')->nullable(false)->change();
$table->string('swift')->nullable(false)->change();
$table->string('cnap')->nullable(false)->change();
$table->string('bank_branch')->nullable(false)->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -0,0 +1,28 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class UpdateAutoincrementStartFrom2000InBookingTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
DB::statement("ALTER TABLE bookings AUTO_INCREMENT = 2000;");
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateSettingBillingChargeTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('setting_billing_charges', function (Blueprint $table) {
$table->increments('id');
$table->double('billing_charge_rate');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('setting_billing_charges');
}
}
@@ -0,0 +1,33 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddOrdernoNPaymentforFieldToBookingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('bookings', function (Blueprint $table) {
$table->string('order_no')->nullable();
$table->string('payment_for')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('bookings', function (Blueprint $table) {
//
});
}
}
@@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateSettingTaxRateTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('setting_tax_rates', function (Blueprint $table) {
$table->increments('id');
$table->double('tax_rate');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('setting_tax_rates');
}
}
@@ -0,0 +1,39 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateNotificationTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('notifications', function (Blueprint $table) {
$table->increments('id');
$table->string('detail');
$table->string('link');
$table->unsignedInteger('user_id');
$table->boolean('is_read')->default(0);
$table->timestamps();
$table->foreign('user_id')
->references('id')->on('users')
->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('notifications');
}
}
@@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddFieldsIntoSupplierBookingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('supplier_bookings', function (Blueprint $table) {
$table->string('amount_in_myr')->nullable();
$table->string('tax_rate')->nullable();
$table->string('amount_after_tax')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -0,0 +1,33 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class ChangeDatatypeInBookingTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('bookings', function (Blueprint $table) {
$table->string('account_num')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('bookings', function (Blueprint $table) {
//
});
}
}
@@ -0,0 +1,42 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class MakeNullableInChinaBankSlipsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('china_bank_slips', function (Blueprint $table) {
$table->string('company_name')->nullable()->change();
$table->string('bank_name')->nullable()->change();
$table->string('acc_no')->nullable()->change();
$table->string('bank_address')->nullable()->change();
$table->string('swift')->nullable()->change();
$table->string('cnap')->nullable()->change();
$table->string('order_id')->nullable()->change();
$table->decimal('transfer_amount_needed')->nullable()->change();
$table->decimal('actual_transfer_amount')->nullable()->change();
$table->string('date')->nullable()->change();
$table->string('details')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('china_bank_slips', function (Blueprint $table) {
//
});
}
}
@@ -0,0 +1,37 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class MakeNullableInBookingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('bookings', function (Blueprint $table) {
$table->string('company_name')->nullable()->change();
$table->string('company_address')->nullable()->change();
$table->string('bank_address')->nullable()->change();
$table->string('swift_code')->nullable()->change();
$table->string('cnap')->nullable()->change();
$table->string('term')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('bookings', function (Blueprint $table) {
//
});
}
}
@@ -0,0 +1,33 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class MakeNullableInSupplierBookingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('supplier_bookings', function (Blueprint $table) {
$table->decimal('transfer_amount')->nullable()->change();
$table->decimal('rmbBankAmount')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('supplier_bookings', function (Blueprint $table) {
//
});
}
}
@@ -0,0 +1,29 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class DropEtaInChinaBankSlipsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('user_bank_slips', function (Blueprint $table) {
$table->dropColumn('estimated_arrival_time');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
}
@@ -0,0 +1,30 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class RemoveBillingAmountInSupplierBookings extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('supplier_bookings', function (Blueprint $table) {
$table->dropColumn('billing_amount');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class DropcolumnBankBranchInChinaBankSlipsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('china_bank_slips', function (Blueprint $table) {
$table->dropColumn('bank_branch');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('china_bank_slips', function (Blueprint $table) {
//
});
}
}
@@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class RemoveForeightFromSettingActiveBanksTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('setting_active_banks', function (Blueprint $table) {
$table->dropForeign('setting_active_banks_beneficiary_id_foreign');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('setting_active_banks', function (Blueprint $table) {
//
});
}
}
@@ -0,0 +1,28 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class DropNotificationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::dropIfExists('notifications');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
}
@@ -0,0 +1,35 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateNotificationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('notifications', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->string('type');
$table->morphs('notifiable');
$table->text('data');
$table->timestamp('read_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('notifications');
}
}
@@ -0,0 +1,35 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class MakeNullableInSettingBeneficiariesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('setting_beneficiaries', function (Blueprint $table) {
$table->string('bank_address')->nullable()->change();
$table->string('swift')->nullable()->change();
$table->string('cnap')->nullable()->change();
$table->string('bank_branch')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('setting_beneficiaries', function (Blueprint $table) {
//
});
}
}
@@ -0,0 +1,35 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class MakeNullableInSettingMalaysiaBanksTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('setting_malaysia_banks', function (Blueprint $table) {
$table->string('bank_address')->nullable()->change();
$table->string('swift')->nullable()->change();
$table->string('cnap')->nullable()->change();
$table->string('bank_branch')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('setting_malaysia_banks', function (Blueprint $table) {
//
});
}
}
+45
View File
@@ -0,0 +1,45 @@
<?php
use Illuminate\Database\Seeder;
use Carbon\Carbon;
use App\User;
use App\Rate;
class BookTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$user = User::where("email", "user@example.com")->first();
$rate = Rate::all()->last();
DB::table('bookings')->insert([
'account_name' => 'EXCHANGE SDN BHD',
'account_num' => '99898239298123',
'bank_name' => 'maybank',
'bank_branch' => 'rembau',
'company_name' => 'ICEF',
'company_address' => 'selangor',
'bank_address' => 'cyber',
'swift_code' => 'qwe123',
'cnap' => '123asd',
'term' => 'x1_cash',
'amount' => 200,
'rmb_book_amount' => 200,
'bia' => 189,
'rate' => 1.2,
'rate_id' => $rate->id,
'user_id' => $user->id,
'status' => 2,
'admin_status' => 1,
'order_no' => '001',
'payment_for' => 'FULL PAYMENT',
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),
]);
}
}
+33
View File
@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
class DatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Eloquent::unguard();
$this->call(UsersTableSeeder::class);
$this->call(RolesAndPermissionsSeeder::class);
$this->call(UserRoleSeeder::class);
$this->call(RateTableSeeder::class);
$this->call(BookTableSeeder::class);
$this->call(SettingCreditSeeder::class);
$this->call(SuppliersTableSeeder::class);
$this->call(MarkingSeeder::class);
DB::statement('SET FOREIGN_KEY_CHECKS=0;');
$this->call(SettingMalaysiaBankSeeder::class);
$this->call(SettingBeneficiarySeeder::class);
$this->call(SettingActiveBankSeeder::class);
$this->call(SettingTaxRateSeeder::class);
$this->call(SettingBillingChargeSeeder::class);
DB::statement('SET FOREIGN_KEY_CHECKS=1;');
}
}
+20
View File
@@ -0,0 +1,20 @@
<?php
use Illuminate\Database\Seeder;
class MarkingSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('markings')->truncate();
DB::table('markings')->insert([
'marking' => 'hehe',
'email' => 'hehe@gmail.com'
]);
}
}
+37
View File
@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Seeder;
use Carbon\Carbon;
class RateTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('rates')->insert([
'x1_cash' => 1.2,
'x1_cheque' => 1.2,
'x1_ba' => 1.2,
'x2_cash' => 1.2,
'x2_cheque' => 1.2,
'x2_ba' => 1.2,
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),
]);
DB::table('rates')->insert([
'x1_cash' => 1.3,
'x1_cheque' => 1.3,
'x1_ba' => 1.3,
'x2_cash' => 1.3,
'x2_cheque' => 1.3,
'x2_ba' => 1.3,
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),
]);
}
}
@@ -0,0 +1,189 @@
<?php
/*
|--------------------------------------------------------------------------
| Roles & Permissions Seeder
|--------------------------------------------------------------------------
|
| This Seeder class allows you to update and create Roles & Permissions
| for the Laravel Entrust package.
|
| USE -> php artisan db:seed --class=RolesAndPermissionsSeeder
|
| https://github.com/thomasfw/RolesAndPermissionsSeeder
|
|--------------------------------------------------------------------------
| Make sure you update the namespaces for your User & Entrust models
|--------------------------------------------------------------------------
*/
use App\User as User;
use App\Role as Role;
use App\Permission as Permission;
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
class RolesAndPermissionsSeeder extends Seeder {
protected $roles = [
'admin' => [
],
'member' => [
],
];
protected $permissions = [
// Add your Permissions here
];
/**
* Roles
*
* @return array()
*/
public function roles()
{
return $this->roles;
}
/**
* Permissions
*
* @param $name
* @return array()
*/
public function permissions($name = '')
{
$single = (array_key_exists($name,$this->permissions) ? array($name =>$this->permissions[$name]) : false );
return ($name ? $single : $this->permissions);
}
/**
* Run the Seeder
*
* @return void
*/
public function run()
{
DB::table(Config::get('entrust.permissions_table'))->delete();
foreach ($this->roles() as $key => $val) {
$this->command->info(" ");
$this->command->info('Creating/updating the \''.$key.'\' role');
$this->command->info('-----------------------------------------');
$val['name'] = $key;
$this->reset($val);
}
$this->cleanup();
}
/**
* Reset Role, Permissions & Users
*
* @param $role
* @return void
*/
public function reset($role)
{
$commandBullet = ' -> ';
// The Old Role
$originalRole = Role::where('name',$role['name'])->first();
if($originalRole) Role::where('id',$originalRole->id)->update(['name' => $role['name'].'__remove']);
// The New Role
$newRole = new Role();
$newRole->name = $role['name'];
if(isset($role['display_name'])) $newRole->display_name = $role['display_name']; // optional
if(isset($role['description'])) $newRole->description = $role['description']; // optional
$newRole->save();
$this->command->info($commandBullet."Created $role[name] role");
// Set the Permissions (if they exist)
$pcount = 0;
if(!empty($role['permissions']))
{
foreach ($role['permissions'] as $permission_name) {
$permission = $this->permissions($permission_name);
if($permission === false || (!$permission_name)) {
$this->command->error($commandBullet."Failed to attach permission '$permission_name'. It does not exist");
continue;
}
$newPermission = \Permission::where('name',$permission_name)->first();
if (!$newPermission) {
$newPermission = new Permission();
$newPermission->name = key($permission);
if(isset($permission['display_name'])) $newPermission->display_name = $permission['display_name']; // optional
if(isset($permission['description'])) $newPermission->description = $permission['description']; // optional
$newPermission->save();
}
$newRole->attachPermission($newPermission);
$pcount++;
}
}
$this->command->info($commandBullet."Attached $pcount permissions to $role[name] role");
// Update old records : Temporary disabled
// if ($originalRole)
// {
// $userCount = 0;
// $RoleUsers = DB::table(Config::get('entrust.role_user_table'))->where('role_id',$originalRole->id)->get();
// foreach ($RoleUsers as $user) {
// $u = User::where('id',$user->user_id)->first();
// $u->attachRole($newRole);
// $userCount++;
// }
// $this->command->info($commandBullet."Updated role attachment for $userCount users");
// Role::where('id',$originalRole->id)->delete(); // will also remove old role_user records
// $this->command->info($commandBullet."Removed the original $role[name] role");
// }
}
/**
* Cleanup()
* Remove any roles & permissions that have been removed
* @return void
*/
public function cleanup()
{
$commandBullet = ' -> ';
$this->command->info(" ");
$this->command->info('Cleaning up roles & permissions:');
$this->command->info('--------------------------------');
$storedRoles = Role::all();
if(!empty($storedRoles)) {
$definedRoles = $this->roles();
foreach ($storedRoles as $role) {
if ( !array_key_exists($role->name,$definedRoles) ) {
Role::where('name',$role->name)->delete();
$this->command->info($commandBullet.'The \''.$role->name.'\' role was removed');
}
}
}
$storedPerms = DB::table(Config::get('entrust.permissions_table'))->get();
if(!empty($storedPerms)) {
$definedPerms = $this->permissions();
foreach ($storedPerms as $perm) {
if ( !array_key_exists($perm->name,$definedPerms) ) {
DB::table(Config::get('entrust.permissions_table'))->where('name',$perm->name)->delete();
$this->command->info($commandBullet.'The \''.$perm->name.'\' permission was removed');
}
}
}
$this->command->info($commandBullet.'Done');
$this->command->info(" ");
}
}
@@ -0,0 +1,27 @@
<?php
use Illuminate\Database\Seeder;
use App\SettingMalaysiaBank;
use App\SettingBeneficiary;
class SettingActiveBankSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$bankx1 = SettingMalaysiaBank::find(1);
$bankx2 = SettingMalaysiaBank::find(2);
$beneficiary = SettingBeneficiary::find(2);
DB::table('setting_active_banks')->truncate();
DB::table('setting_active_banks')->insert([
'x1_bank_id' => $bankx1->id,
'x2_bank_id' => $bankx2->id,
'beneficiary_id' => $beneficiary->id
]);
}
}
@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Seeder;
use App\SettingBeneficiary;
class SettingBeneficiarySeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('setting_beneficiaries')->truncate();
DB::table('setting_beneficiaries')->insert([
'company_name' => 'CIEF2',
'bank_name' => 'Mayban222k',
'acc_no' => '5555555',
'bank_address' => 'Jalan putrajaya',
'swift' => 'ABC122223',
'cnap' => 'CED232224',
'bank_branch' => 'Putra'
]);
DB::table('setting_beneficiaries')->insert([
'company_name' => 'CIEF1',
'bank_name' => 'CIMB',
'acc_no' => '123456789',
'bank_address' => 'Jalan cyberjaya',
'swift' => 'AB3333',
'cnap' => 'CADSeed',
'bank_branch' => 'cyberjaa
'
]);
}
}
@@ -0,0 +1,18 @@
<?php
use Illuminate\Database\Seeder;
class SettingBillingChargeSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('setting_billing_charges')->insert([
'billing_charge_rate' => '1.2',
]);
}
}
+21
View File
@@ -0,0 +1,21 @@
<?php
use Illuminate\Database\Seeder;
use App\SettingCredit;
class SettingCreditSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('setting_credits')->insert([
'rmb_credit_limit' => '100000',
'usd_credit_limit' => '100000',
'time_limit' => '60000'
]);
}
}
@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Seeder;
class SettingMalaysiaBankSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('setting_active_banks')->truncate();
DB::table('setting_malaysia_banks')->truncate();
DB::table('setting_malaysia_banks')->insert([
'company_name' => 'CIEF',
'bank_name' => 'MAYBANK',
'acc_no' => '75930284783',
'bank_address' => 'Jalan putrajaya',
'swift' => 'ABC123',
'cnap' => 'CED234',
'bank_branch' => 'Putra'
]);
DB::table('setting_malaysia_banks')->insert([
'company_name' => 'CIEF',
'bank_name' => 'MAYBANK',
'acc_no' => '85839298348',
'bank_address' => 'Jalan putrajaya',
'swift' => 'ABC123',
'cnap' => 'CED234',
'bank_branch' => 'Putra'
]);
}
}
+18
View File
@@ -0,0 +1,18 @@
<?php
use Illuminate\Database\Seeder;
class SettingTaxRateSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('setting_tax_rates')->insert([
'tax_rate' => '1.0',
]);
}
}
+21
View File
@@ -0,0 +1,21 @@
<?php
use Illuminate\Database\Seeder;
class SuppliersTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('setting_suppliers')->insert([
'company_name' => 'WongKok PLT',
'gst_no' => 'GTS12232123',
'bank_name' => 'HSBC',
'acc_no' => '86774723848593'
]);
}
}
+25
View File
@@ -0,0 +1,25 @@
<?php
use Illuminate\Database\Seeder;
use App\User;
use App\Role;
class UserRoleSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$user = User::where("email", "=" , "user@example.com")->first();
$admin = User::where("email", "=", "admin@example.com")->first();
$role_user = Role::where('name','=','member')->first();
$role_admin = Role::where('name','=','admin')->first();
$user->attachRole($role_user);
$admin->attachRole($role_admin);
}
}
+30
View File
@@ -0,0 +1,30 @@
<?php
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
use App\User;
class UsersTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('users')->delete();
$users = array(
['name' => 'User', 'marking'=> 'X9', 'email' => 'user@example.com', 'password' => Hash::make('secret')],
['name' => 'Admin', 'marking'=> 'X10', 'email' => 'admin@example.com', 'password' => Hash::make('secret')],
);
foreach ($users as $user)
{
$newUser = User::create($user);
}
}
}