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/CustomerSeeder.php

102 lines
4.0 KiB
PHTML

3 months ago
<?php
namespace Database\Seeders;
use App\Models\Contact;
use App\Models\Customer;
use App\Models\Order;
use App\Models\OrderProduct;
use App\Models\PackingSlip;
use App\Models\ProductService;
use App\Models\ProductSize;
2 months ago
use App\Models\ServiceFile;
3 months ago
use App\Models\ShippingEntry;
use Illuminate\Database\Seeder;
class CustomerSeeder extends Seeder
{
public function run(): void
{
for ($i = 0; $i < 5; $i++) {
2 months ago
Customer::factory()
->has(Contact::factory(rand(1, 5)))
->has(ShippingEntry::factory(rand(1, 3)))
2 months ago
->has(Order::factory(rand(5, 10))
->has(OrderProduct::factory(rand(1, 3))
->has(productSize::factory(rand(1, 3))))
->has(ProductService::factory(rand(1, 5), [
'service_file_id' => ServiceFile::factory(),
2 months ago
]))
->has(PackingSlip::factory(rand(0, 2))))
2 months ago
->create();
}
3 months ago
Customer::factory([
'company_name' => 'Genumark',
'internal_name' => 'genumark',
'shipping_address' => '',
'billing_address' => '',
])
->has(Contact::factory([
'first_name' => 'Tammy',
'last_name' => 'Bookbinder',
'email' => 'tbookbinder@genumark.com',
'phone' => '+1 778 229 5668',
]))
->has(Contact::factory([
'first_name' => 'Kathlyn',
'last_name' => 'Wood',
'email' => 'kwood@genumark.com',
'phone' => '+1 604 294 2376',
'notes' => 'Always CC, unless SOF order',
]))
->has(Contact::factory([
'first_name' => 'Jane',
'last_name' => 'Wellman',
'email' => 'jwellman@genumark.com',
'phone' => '+1 604 742 5584',
'notes' => 'Deals with SOF orders',
]))
->has(Contact::factory([
'first_name' => 'Trisha',
'last_name' => 'Miller',
'email' => 'tmiller@genumark.com',
'phone' => '+1 604 802 8486',
]))
->has(Contact::factory([
'first_name' => 'Brenda',
'last_name' => 'Kuepfer',
'email' => 'bkuepfer@genumark.com',
'phone' => '+1 604 305 5002',
]))
->has(PackingSlip::factory(20))
->has(ShippingEntry::factory([
'account_title' => 'Genumark',
'courier' => 'UPS CampusShip',
'contact' => 'https://www.ups.com/lasso/login',
'account_username' => 'GenumarkTopNotch',
'account_password' => 'TopNotch@13579',
'info_needed' => 'Put PO on box',
'notify' => 'Various reps, CC Kathlyn Wood',
'notes' => 'For Save On Foods orders, see Genumark SOF',
]))
->has(ShippingEntry::factory([
'account_title' => 'Genumark Save-On-Foods',
'courier' => 'UPS CampusShip',
'contact' => 'https://www.ups.com/lasso/login',
'account_username' => 'GenumarkTopNotch',
'account_password' => 'TopNotch@13579',
'info_needed' => 'Put PO on box',
'notify' => 'Jane Wellman',
'notes' => 'Don\'t CC Kathlyn for SOF orders',
]))
->has(Order::factory(rand(2, 10))
2 months ago
->has(OrderProduct::factory(rand(1, 10))
->has(productSize::factory(rand(1, 8))))
->has(ProductService::factory(rand(1, 10), [
'service_file_id' => ServiceFile::factory(),
])))
3 months ago
->create();
}
}