-
Notifications
You must be signed in to change notification settings - Fork 0
/
BoardFactory.php
78 lines (69 loc) · 1.65 KB
/
BoardFactory.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
/**
* Playground
*/
declare(strict_types=1);
namespace Database\Factories\Playground\Matrix\Models;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
use Playground\Matrix\Models\Board;
/**
* \Database\Factories\Playground\Matrix\Models\BoardFactory
*
* @extends Factory<Board>
*/
class BoardFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var class-string<Board>
*/
protected $model = Board::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
$title = $this->faker->sentence(3);
return [
'label' => $this->faker->sentence(3),
'title' => $title,
'slug' => Str::slug($title, '-'),
'description' => $this->faker->sentence(3),
'introduction' => $this->faker->sentence(3),
'content' => $this->faker->sentence(3),
'summary' => $this->faker->sentence(3),
];
}
// States: flags
/**
* @return Factory<Board>
*/
public function locked(): Factory
{
return $this->state(fn (array $attributes) => [
'locked' => true,
]);
}
/**
* @return Factory<Board>
*/
public function featured(): Factory
{
return $this->state(fn (array $attributes) => [
'featured' => true,
]);
}
/**
* @return Factory<Board>
*/
public function special(): Factory
{
return $this->state(fn (array $attributes) => [
'special' => true,
]);
}
}