AI store generator for ecommerce, Malaysia first. Laravel 13 + React + TypeScript.
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

OrderFactory.php 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace Database\Factories;
  3. use App\Enums\OrderStatus;
  4. use App\Models\Order;
  5. use App\Models\Store;
  6. use Illuminate\Database\Eloquent\Factories\Factory;
  7. use Illuminate\Support\Str;
  8. /**
  9. * @extends Factory<Order>
  10. */
  11. class OrderFactory extends Factory
  12. {
  13. /**
  14. * @return array<string, mixed>
  15. */
  16. public function definition(): array
  17. {
  18. return [
  19. 'store_id' => Store::factory(),
  20. 'public_id' => fn () => (string) Str::ulid(),
  21. 'number' => fake()->unique()->numberBetween(1001, 999999),
  22. 'status' => OrderStatus::Pending,
  23. 'customer_name' => 'Aminah binti Ali',
  24. 'customer_email' => 'aminah@example.com',
  25. 'customer_phone' => '0123456789',
  26. 'shipping_address' => [
  27. 'line1' => '12 Jalan Mawar',
  28. 'line2' => null,
  29. 'city' => 'Shah Alam',
  30. 'postcode' => '40000',
  31. 'state' => 'Selangor',
  32. 'country' => 'MY',
  33. ],
  34. 'subtotal' => 2580,
  35. 'shipping_total' => 0,
  36. 'total' => 2580,
  37. 'currency' => 'MYR',
  38. ];
  39. }
  40. public function paid(): static
  41. {
  42. return $this->state(['status' => OrderStatus::Paid, 'paid_at' => now(), 'payment_reference' => 'pi_test']);
  43. }
  44. }