52 lines
1.5 KiB
PHP
52 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Member;
|
|
use App\Models\MembershipPayment;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
class MembershipPaymentFactory extends Factory
|
|
{
|
|
protected $model = MembershipPayment::class;
|
|
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'member_id' => Member::factory(),
|
|
'paid_at' => now()->format('Y-m-d'),
|
|
'amount' => $this->faker->numberBetween(500, 5000),
|
|
'method' => MembershipPayment::METHOD_BANK_TRANSFER,
|
|
'payment_method' => MembershipPayment::METHOD_BANK_TRANSFER,
|
|
'reference' => $this->faker->bothify('REF-######'),
|
|
'status' => MembershipPayment::STATUS_PENDING,
|
|
'submitted_by_user_id' => null,
|
|
'notes' => $this->faker->sentence(),
|
|
];
|
|
}
|
|
|
|
public function approvedCashier(): static
|
|
{
|
|
return $this->state(fn () => [
|
|
'status' => MembershipPayment::STATUS_APPROVED_CASHIER,
|
|
'cashier_verified_at' => now(),
|
|
]);
|
|
}
|
|
|
|
public function approvedAccountant(): static
|
|
{
|
|
return $this->state(fn () => [
|
|
'status' => MembershipPayment::STATUS_APPROVED_ACCOUNTANT,
|
|
'accountant_verified_at' => now(),
|
|
]);
|
|
}
|
|
|
|
public function approvedChair(): static
|
|
{
|
|
return $this->state(fn () => [
|
|
'status' => MembershipPayment::STATUS_APPROVED_CHAIR,
|
|
'chair_verified_at' => now(),
|
|
]);
|
|
}
|
|
}
|