Files
Caramel-CRM/database/factories/CustomerFactory.php
T
vollstock e6a75bf16b Added customer_nr to database and invoice templates.
Used standard DATEV format(10000 – 69999)

Fixes #31
2025-10-21 17:12:50 +02:00

36 lines
1.3 KiB
PHP

<?php
namespace Database\Factories;
use App\Models\PaymentTerms;
use Illuminate\Database\Eloquent\Factories\Factory;
use App\Http\Controllers\CustomerController;
class CustomerFactory extends Factory
{
protected $model = \App\Models\Customer::class;
public function definition()
{
return [
'type' => $this->faker->randomElement(['private', 'business']),
'company_name' => $this->faker->company(),
'customer_nr' => CustomerController::generateCustomerNumber(),
'vat_id' => $this->faker->numerify('DE##########'),
'tax_id' => $this->faker->numerify('DE##########'),
'global_id' => $this->faker->numerify('############'),
'legal_registration_id' => $this->faker->numerify('##########'),
'email' => $this->faker->unique()->safeEmail(),
'phone' => $this->faker->phoneNumber(),
'billing_address' => [
'line_one' => $this->faker->streetAddress(),
'line_two' => '',
'city' => $this->faker->city(),
'postal_code' => $this->faker->postcode(),
'country_code' => 'DE',
],
'payment_terms_id' => PaymentTerms::where('name', 'daysAfterInvoice')->first()->id,
'logo' => null,
];
}
}