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

64 lines
1.5 KiB
PHP

<?php
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use App\Libraries\UuidHelper;
use Faker\Factory as Faker;
use App\Helpers\StringHelper;
use App\Libraries\StaticContents;
class PaymentsTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('payments')->truncate();
for ($i=1; $i <= 20; $i++) {
$uuid = new UuidHelper;
$uuid = $uuid->generate_uuid1();
$faker = Faker::create();
$lastName = $faker->lastName;
$firstName = $faker->firstName;
$amount = rand(100,5000);
$data[] = array(
'payment_uuid' => $uuid,
'lcard_id' => rand(1,20),
'station_id' => StaticContents::app_station_id(),
'payer_id' => rand(1,20),
'firstname' => $firstName,
'lastname' => $lastName,
'business' => 'sample',
'verify_sign' => 'sample1234',
'payer_email' => $faker->email,
'receiver_email'=> $faker->email,
'trans_num' => rand(10000,99999),
'item_name' => 'PREPAID LOAD',
'item_code' => 'PREPAID',
'item_number' => rand(1,20),
'ip_track_id' => '13.45.34.'.$i,
'other' => 'other',
'amount' => $amount,
'points' => $amount,
'entry_type_code' => 'APP',
'entry_type_desc' => 'APP',
'quantity' => 1,
'paid_at' => date('Y-m-d H:i:s'),
'created_at' => date('Y-m-d H:i:s'),
'created_by' => 0
);
}
DB::table('payments')->insert($data);
}
}