New Route for booking cancel. Fix bookingTest hardcoded link. Add Cancel function to bookingcontroller. Get Latest Rate for bookingController@store.

This commit is contained in:
Too
2018-06-16 14:40:39 +08:00
parent e3fb93fbae
commit 8f431ed090
7 changed files with 147 additions and 48 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,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');
});
}
}
}