Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pterodactyl
GitHub Repository: pterodactyl/panel
Path: blob/1.0-develop/database/Factories/EggVariableFactory.php
7458 views
1
<?php
2
3
namespace Database\Factories;
4
5
use Illuminate\Support\Str;
6
use Pterodactyl\Models\EggVariable;
7
use Illuminate\Database\Eloquent\Factories\Factory;
8
9
class EggVariableFactory extends Factory
10
{
11
/**
12
* The name of the factory's corresponding model.
13
*
14
* @var string
15
*/
16
protected $model = EggVariable::class;
17
18
/**
19
* Define the model's default state.
20
*/
21
public function definition(): array
22
{
23
return [
24
'name' => $this->faker->unique()->firstName,
25
'description' => $this->faker->sentence(),
26
'env_variable' => Str::upper(Str::replaceArray(' ', ['_'], $this->faker->words(2, true))),
27
'default_value' => $this->faker->colorName,
28
'user_viewable' => 0,
29
'user_editable' => 0,
30
'rules' => 'required|string',
31
];
32
}
33
34
/**
35
* Indicate that the egg variable is viewable.
36
*/
37
public function viewable(): static
38
{
39
return $this->state(function (array $attributes) {
40
return [
41
'user_viewable' => 1,
42
];
43
});
44
}
45
46
/**
47
* Indicate that the egg variable is editable.
48
*/
49
public function editable(): static
50
{
51
return $this->state(function (array $attributes) {
52
return [
53
'user_editable' => 1,
54
];
55
});
56
}
57
}
58
59