| 1 |
<?php |
| 2 |
|
| 3 |
namespace App\Billingo\Factories; |
| 4 |
|
| 5 |
use App\Billingo\Enums\CurrencyEnum; |
| 6 |
use App\Billingo\Enums\EntitlementEnum; |
| 7 |
use App\Billingo\Enums\VatEnum; |
| 8 |
|
| 9 |
class ProductFactory extends BaseFactory |
| 10 |
{ |
| 11 |
|
| 12 |
public function definition(): array |
| 13 |
{ |
| 14 |
$netUnitPrice = $this->faker->randomFloat(2, 1, 1000); |
| 15 |
|
| 16 |
return [ |
| 17 |
'id' => $this->faker->optional()->randomNumber(), |
| 18 |
'name' => $this->faker->word(), |
| 19 |
'comment' => $this->faker->optional()->sentence(), |
| 20 |
'currency' => $this->faker->randomElement(getEnumValues(CurrencyEnum::class)), |
| 21 |
'vat' => $this->faker->randomElement(getEnumValues(VatEnum::class)), |
| 22 |
'net_unit_price' => $netUnitPrice, |
| 23 |
'gross_unit_price' => $this->faker->optional(0.1)->randomFloat(2, 1, 1000), |
| 24 |
'unit' => $this->faker->word(), |
| 25 |
'general_ledger_number' => $this->faker->optional()->regexify('[A-Z]{4}-[0-9]{6}'), |
| 26 |
'general_ledger_taxcode' => $this->faker->optional()->regexify('[A-Z]{4}-[0-9]{6}'), |
| 27 |
'entitlement' => $this->faker->optional()->randomElement(getEnumValues(EntitlementEnum::class)), |
| 28 |
'ean' => $this->faker->optional()->ean13(), |
| 29 |
'sku' => $this->faker->optional()->regexify('[A-Z]{5}-[0-9]{5}'), |
| 30 |
'is_manage' => $this->faker->optional()->boolean(), |
| 31 |
'purchase_price' => $this->faker->optional()->randomFloat(2, 1, 1000), |
| 32 |
]; |
| 33 |
} |
| 34 |
} |
| 35 |
|