add migration for notification. update booking confirmation

This commit is contained in:
weiweitoo
2018-07-21 14:15:42 +08:00
parent 1b874d0800
commit 81bf3ac585
7 changed files with 141 additions and 30 deletions
@@ -0,0 +1,37 @@
<?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->unsignedInteger('user_id');
$table->timestamps();
$table->foreign('user_id')
->references('id')->on('users')
->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('notifications');
}
}
+1
View File
@@ -28,6 +28,7 @@ class DatabaseSeeder extends Seeder
$this->call(SettingActiveBankSeeder::class);
$this->call(SettingTaxRateSeeder::class);
$this->call(SettingBillingChargeSeeder::class);
$this->call(NotificationSeeder::class);
DB::statement('SET FOREIGN_KEY_CHECKS=1;');
}
}
+33
View File
@@ -0,0 +1,33 @@
<?php
use Illuminate\Database\Seeder;
use App\User;
use Carbon\Carbon;
class NotificationSeeder 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();
DB::table('notifications')->insert([
'detail' => 'This is an user seeder notification',
'user_id' => $user->id,
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),
]);
DB::table('notifications')->insert([
'detail' => 'This is an admin seeder notification',
'user_id' => $admin->id,
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),
]);
}
}