orderFactory.php 671 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace Database\Factories;
  3. use Illuminate\Database\Eloquent\Factories\Factory;
  4. use App\Models\order;
  5. use App\Models\employee;
  6. /**
  7. * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\order>
  8. */
  9. class orderFactory extends Factory
  10. {
  11. protected $model = order::class;
  12. /**
  13. * Define the model's default state.
  14. *
  15. * @return array<string, mixed>
  16. */
  17. public function definition()
  18. {
  19. return [
  20. 'employee_id' => employee::factory(), // Automatically associate with an Employee
  21. 'total' => $this->faker->randomFloat(2, 50, 1000), // Total amount between $50 and $1000
  22. ];
  23. }
  24. }