77 lines
1.9 KiB
PHP
77 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Module;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Module>
|
|
*/
|
|
class ModuleFactory extends Factory
|
|
{
|
|
protected $model = Module::class;
|
|
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
$municipalities = [
|
|
'Centro',
|
|
'Cárdenas',
|
|
'Comalcalco',
|
|
'Cunduacán',
|
|
'Huimanguillo',
|
|
'Macuspana',
|
|
'Paraíso',
|
|
'Tacotalpa',
|
|
'Teapa',
|
|
'Tenosique',
|
|
];
|
|
|
|
$colonies = [
|
|
'Centro',
|
|
'Tierra Colorada',
|
|
'Atasta de Serra',
|
|
'José Colomo',
|
|
'La Manga',
|
|
'Tamulté de las Barrancas',
|
|
'Gaviotas Norte',
|
|
'Carrizal',
|
|
];
|
|
|
|
return [
|
|
'name' => fake()->company() . ' - ' . fake()->randomElement($municipalities),
|
|
'municipality' => fake()->randomElement($municipalities),
|
|
'address' => fake()->streetAddress(),
|
|
'colony' => fake()->randomElement($colonies),
|
|
'longitude' => fake()->longitude(-93.5, -92.5), // Tabasco longitude range
|
|
'latitude' => fake()->latitude(17.5, 18.5), // Tabasco latitude range
|
|
'status' => fake()->boolean(90), // 90% activos
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Indicate that the module is inactive.
|
|
*/
|
|
public function inactive(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'status' => false,
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Indicate that the module is in Centro municipality.
|
|
*/
|
|
public function centro(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'municipality' => 'Centro',
|
|
]);
|
|
}
|
|
}
|