PaymentFactory.php 906 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace Database\Factories;
  3. use App\Models\Payment;
  4. use App\Models\User;
  5. use Illuminate\Database\Eloquent\Factories\Factory;
  6. use Illuminate\Support\Str;
  7. class PaymentFactory extends Factory
  8. {
  9. /**
  10. * The name of the factory's corresponding model.
  11. *
  12. * @var string
  13. */
  14. protected $model = Payment::class;
  15. /**
  16. * Define the model's default state.
  17. *
  18. * @return array
  19. */
  20. public function definition()
  21. {
  22. return [
  23. 'payment_id' => Str::random(30),
  24. 'payer_id' => Str::random(30),
  25. 'user_id' => User::factory(),
  26. 'type' => "Credits",
  27. 'status' => "Completed",
  28. 'amount' => $this->faker->numberBetween(10, 10000),
  29. 'price' => $this->faker->numerify('##.##'),
  30. 'currency_code' => ['EUR', 'USD'][rand(0,1)],
  31. 'payer' => '{}',
  32. ];
  33. }
  34. }