2023-12-16 01:13:49 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Database\Factories\Invoice\Models;
|
|
|
|
|
|
|
|
use App\Invoice\Models\InvoicePosition;
|
|
|
|
use App\Member\Member;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @extends Factory<InvoicePosition>
|
|
|
|
*/
|
|
|
|
class InvoicePositionFactory extends Factory
|
|
|
|
{
|
|
|
|
protected $model = InvoicePosition::class;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Define the model's default state.
|
|
|
|
*
|
|
|
|
* @return array<string, mixed>
|
|
|
|
*/
|
|
|
|
public function definition()
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'description' => $this->faker->words(4, true),
|
2023-12-17 00:45:03 +01:00
|
|
|
'price' => $this->faker->numberBetween(1000, 2000),
|
2023-12-16 01:13:49 +01:00
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2023-12-17 21:13:52 +01:00
|
|
|
public function description(string $description): self
|
|
|
|
{
|
|
|
|
return $this->state(['description' => $description]);
|
|
|
|
}
|
|
|
|
|
2023-12-16 01:13:49 +01:00
|
|
|
public function price(int $price): self
|
|
|
|
{
|
|
|
|
return $this->state(['price' => $price]);
|
|
|
|
}
|
2023-12-17 01:49:12 +01:00
|
|
|
|
|
|
|
public function withMember(): self
|
|
|
|
{
|
|
|
|
return $this->state(['member_id' => Member::factory()->defaults()->create()->id]);
|
|
|
|
}
|
2023-12-16 01:13:49 +01:00
|
|
|
}
|