April 2026 waren Wirtschaft Feedback
This commit is contained in:
parent
02f2a4c23e
commit
9ce711d6b2
167 changed files with 25278 additions and 8518 deletions
48
database/factories/SupplierFactory.php
Normal file
48
database/factories/SupplierFactory.php
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Country;
|
||||
use App\Models\Supplier;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<Supplier>
|
||||
*/
|
||||
class SupplierFactory extends Factory
|
||||
{
|
||||
protected $model = Supplier::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => $this->faker->company(),
|
||||
'url' => $this->faker->optional()->url(),
|
||||
'contact_person' => $this->faker->optional()->name(),
|
||||
'email' => $this->faker->optional()->companyEmail(),
|
||||
'phone' => $this->faker->optional()->phoneNumber(),
|
||||
'country_id' => Country::query()->value('id') ?? $this->resolveCountryId(),
|
||||
'notes' => null,
|
||||
'active' => true,
|
||||
];
|
||||
}
|
||||
|
||||
protected function resolveCountryId(): int
|
||||
{
|
||||
$country = Country::query()->firstOrCreate(
|
||||
['code' => 'TE'],
|
||||
[
|
||||
'phone' => '00',
|
||||
'en' => 'Testland',
|
||||
'de' => 'Testland',
|
||||
'es' => 'Testland',
|
||||
'fr' => 'Testland',
|
||||
'it' => 'Testland',
|
||||
'ru' => 'Testland',
|
||||
'active' => true,
|
||||
]
|
||||
);
|
||||
|
||||
return (int) $country->id;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue