forked from TFMM/silent-auction
Add seeders and factories for all models
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use App\Models\Checkout;
|
||||
use App\Models\Bidders;
|
||||
use App\Models\PaymentMethods;
|
||||
|
||||
class CheckoutTableSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$bidders = Bidders::all();
|
||||
$paymentMethods = PaymentMethods::all();
|
||||
|
||||
foreach ($bidders as $bidder) {
|
||||
if (rand(0, 1)) {
|
||||
factory(Checkout::class)->create([
|
||||
'bidder_num' => $bidder->idbidders,
|
||||
'payment_method' => $paymentMethods->random()->pm_id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user