2021-01-23 20:09:16 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Database\Factories;
|
|
|
|
|
|
|
|
use Illuminate\Support\Str;
|
|
|
|
use Pterodactyl\Models\EggVariable;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
|
|
|
|
class EggVariableFactory extends Factory
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The name of the factory's corresponding model.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $model = EggVariable::class;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Define the model's default state.
|
|
|
|
*/
|
|
|
|
public function definition(): array
|
|
|
|
{
|
|
|
|
return [
|
2021-07-11 17:27:15 +00:00
|
|
|
'name' => $this->faker->unique()->firstName,
|
2021-01-23 20:09:16 +00:00
|
|
|
'description' => $this->faker->sentence(),
|
|
|
|
'env_variable' => Str::upper(Str::replaceArray(' ', ['_'], $this->faker->words(2, true))),
|
|
|
|
'default_value' => $this->faker->colorName,
|
|
|
|
'user_viewable' => 0,
|
|
|
|
'user_editable' => 0,
|
|
|
|
'rules' => 'required|string',
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicate that the egg variable is viewable.
|
|
|
|
*/
|
2023-02-23 19:30:16 +00:00
|
|
|
public function viewable(): static
|
2021-01-23 20:09:16 +00:00
|
|
|
{
|
|
|
|
return $this->state(function (array $attributes) {
|
|
|
|
return [
|
|
|
|
'user_viewable' => 1,
|
|
|
|
];
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicate that the egg variable is editable.
|
|
|
|
*/
|
2023-02-23 19:30:16 +00:00
|
|
|
public function editable(): static
|
2021-01-23 20:09:16 +00:00
|
|
|
{
|
|
|
|
return $this->state(function (array $attributes) {
|
|
|
|
return [
|
|
|
|
'user_editable' => 1,
|
|
|
|
];
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|