Initial commit

This commit is contained in:
James
2024-12-03 21:27:44 +01:00
commit 613e1a767c
125 changed files with 16298 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
<?php
declare(strict_types=1);
namespace Database\Factories;
use App\Enums\WalletTransactionType;
use App\Models\WalletTransaction;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<WalletTransaction>
*/
class WalletTransactionFactory extends Factory
{
public function definition(): array
{
return [
'amount' => fake()->numberBetween(1, 100),
'type' => fake()->randomElement([
WalletTransactionType::DEBIT,
WalletTransactionType::CREDIT,
]),
'reason' => fake()->sentence(),
];
}
public function credit(): self
{
return $this->state(function (array $attributes) {
return [
'type' => WalletTransactionType::CREDIT,
];
});
}
public function debit(): self
{
return $this->state(function (array $attributes) {
return [
'type' => WalletTransactionType::DEBIT,
];
});
}
public function amount(int $amount): self
{
return $this->state(fn (array $attributes) => [
'amount' => $amount,
]);
}
public function reason(string $reason): self
{
return $this->state(fn (array $attributes) => [
'reason' => $reason,
]);
}
}