unioil-loyalty-app/database/seeds/RatingsTableSeeder.php

39 lines
719 B
PHP
Executable File

<?php
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use App\Libraries\UuidHelper;
class RatingsTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('ratings')->truncate();
for ($i=1; $i <= 20; $i++) {
$uuid = new UuidHelper;
$uuid = $uuid->generate_uuid1();
$data[] = array(
'rating_uuid' => $uuid,
'lcard_id' => rand(1,20),
'station_id' => rand(1,63),
'payment_id' => rand(1,20),
'rate' => rand(1,5),
'created_at' => date('Y-m-d H:i:s'),
'created_by' => 0
);
}
DB::table('ratings')->insert($data);
}
}