44 lines
1.2 KiB
PHP
44 lines
1.2 KiB
PHP
<?php
|
|||
|
|
|
||
|
|
namespace Database\Factories;
|
||
|
|
|
||
|
|
use App\Models\Location;
|
||
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @extends Factory<Location>
|
||
|
|
*/
|
||
|
|
class LocationFactory extends Factory
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* Define the model's default state.
|
||
|
|
*
|
||
|
|
* @return array<string, mixed>
|
||
|
|
*/
|
||
|
|
public function definition(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'name' => $this->faker->unique()->city() . ' ' . $this->faker->randomElement(['District', 'Area', 'Sector', 'Zone']),
|
||
|
|
'slug' => $this->faker->unique()->slug(2),
|
||
|
|
'description' => $this->faker->sentence(),
|
||
|
|
'travel_cost' => $this->faker->numberBetween(100, 5000),
|
||
|
|
'requires_level' => $this->faker->randomElement([null, 1, 3, 5, 10, 15]),
|
||
|
|
'faction_control' => null,
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Create a starting location.
|
||
|
|
*/
|
||
|
|
public function starting(): static
|
||
|
|
{
|
||
|
|
return $this->state(fn (array $attributes) => [
|
||
|
|
'name' => 'Downtown',
|
||
|
|
'slug' => 'downtown',
|
||
|
|
'description' => 'The bustling city center with plenty of opportunities.',
|
||
|
|
'travel_cost' => 0,
|
||
|
|
'requires_level' => null,
|
||
|
|
]);
|
||
|
|
}
|
||
|
|
}
|