Add PaymentFactory and SubscriptionFactory
This commit is contained in:
parent
a3c97f5d19
commit
7eeb88ce98
|
@ -0,0 +1,40 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Factories\Payment;
|
||||||
|
|
||||||
|
use App\Fee;
|
||||||
|
use App\Payment\Payment;
|
||||||
|
use App\Payment\Status;
|
||||||
|
use App\Payment\Subscription;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
|
class PaymentFactory extends Factory
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $model = Payment::class;
|
||||||
|
|
||||||
|
public function definition(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function notPaid(): self
|
||||||
|
{
|
||||||
|
return $this->for(Status::whereName('Nicht bezahlt')->first());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function nr(string $nr): self
|
||||||
|
{
|
||||||
|
return $this->state(['nr' => $nr]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function subscription(string $name, int $amount): self
|
||||||
|
{
|
||||||
|
return $this->for(
|
||||||
|
Subscription::factory()->state(['name' => $name, 'amount' => $amount])->for(Fee::first()),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Factories\Payment;
|
||||||
|
|
||||||
|
use App\Payment\Subscription;
|
||||||
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
|
class SubscriptionFactory extends Factory
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $model = Subscription::class;
|
||||||
|
|
||||||
|
public function definition(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => $this->faker->name,
|
||||||
|
'amount' => $this->faker->numberBetween(1000, 50000),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue