AssetFactory.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace Database\Factories;
  3. use App\Models\AssetGroup;
  4. use Illuminate\Database\Eloquent\Factories\Factory;
  5. use Illuminate\Support\Facades\Auth;
  6. /**
  7. * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Asset>
  8. */
  9. class AssetFactory extends Factory
  10. {
  11. /**
  12. * Define the model's default state.
  13. *
  14. * @return array<string, mixed>
  15. */
  16. public function definition(): array
  17. {
  18. return [
  19. 'name' => fake()->name(),
  20. 'code' => fake()->randomNumber(5),
  21. 'description' => fake()->text(),
  22. 'company_id' => Auth::user()->company_id,
  23. 'status' => 'doing',
  24. 'created_by' => Auth::user()->id,
  25. 'owner' => Auth::id(),
  26. 'address' => fake()->address(),
  27. 'group_id' => AssetGroup::factory()->create()?->id,
  28. 'geo_address_code' => fake()->randomNumber(5),
  29. 'acl' => 'custom',
  30. 'whitelist' => ',1,',
  31. 'latitude' => fake()->latitude(),
  32. 'longitude' => fake()->longitude(),
  33. ];
  34. }
  35. }