|
Server : Apache/2.4.41 (Ubuntu) System : Linux vmi1525618.contaboserver.net 5.4.0-105-generic #119-Ubuntu SMP Mon Mar 7 18:49:24 UTC 2022 x86_64 User : www-data ( 33) PHP Version : 8.2.12 Disable Function : NONE Directory : /var/www/___pospro/superadmin.balancebizness.com/database/seeders/ |
Upload File : |
<?php
namespace Database\Seeders;
use App\Models\Business;
use App\Models\PaymentType;
use Illuminate\Database\Seeder;
class PaymentTypeSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$businesses = Business::pluck('id');
$defaultPaymentTypes = ['Cash', 'Card', 'Check', 'Mobile Pay', 'Due'];
$payment_types = [];
foreach ($businesses as $business_id) {
foreach ($defaultPaymentTypes as $type) {
$payment_types[] = [
'business_id' => $business_id,
'name' => $type,
'status' => 1,
'created_at' => now(),
'updated_at' => now(),
];
}
}
PaymentType::insert($payment_types);
}
}