Files
exchange/database/seeds/NotificationSeeder.php
2018-07-24 17:02:45 +08:00

36 lines
1.0 KiB
PHP

<?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,
'link' => 'http://www.google.com',
'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,
'link' => 'http://www.google.com',
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),
]);
}
}