You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
topnotch_website/database/seeders/ContactSeeder.php

58 lines
2.0 KiB
PHP

<?php
namespace Database\Seeders;
use App\Models\Contact;
use App\Models\Customer;
use Illuminate\Database\Seeder;
class ContactSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
foreach (Customer::all() as $customer) {
if ($customer->company_name === 'Genumark') {
$customer->contacts()->createMany([
[
'first_name' => 'Tammy',
'last_name' => 'Bookbinder',
'email' => 'tbookbinder@genumark.com',
'phone' => '+1 778 229 5668',
],
[
'first_name' => 'Kathlyn',
'last_name' => 'Wood',
'email' => 'kwood@genumark.com',
'phone' => '+1 604 294 2376',
'notes' => 'Always CC, unless SOF order',
],
[
'first_name' => 'Jane',
'last_name' => 'Wellman',
'email' => 'jwellman@genumark.com',
'phone' => '+1 604 742 5584',
'notes' => 'Deals with SOF orders',
],
[
'first_name' => 'Trisha',
'last_name' => 'Miller',
'email' => 'tmiller@genumark.com',
'phone' => '+1 604 802 8486',
],
[
'first_name' => 'Brenda',
'last_name' => 'Kuepfer',
'email' => 'bkuepfer@genumark.com',
'phone' => '+1 604 305 5002',
],
]);
} else {
Contact::factory(rand(1, 4))->for($customer)->create();
}
}
}
}