You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

21 lines
653 B

<?php
/** @var Factory $factory */
use Carbon\Carbon;
use App\Transaction;
use Faker\Generator as Faker;
use Illuminate\Support\Facades\DB;
$factory->define(Transaction::class, function (Faker $faker) {
$business_user = DB::selectOne('select business_id, user_id from business_user where level = 4 order by rand() limit 1');
return [
'user_id' => $business_user->user_id,
'business_id' => $business_user->business_id,
'amount' => random_int(1000, 9999),
'succeeded' => $faker->boolean(),
'options' => json_encode([]),
'created_at' => Carbon::now()->subMinutes(random_int(1, 1000)),
];
});