3
3
namespace Tepuilabs \SimpleCrm \Database \Factories ;
4
4
5
5
use Illuminate \Database \Eloquent \Factories \Factory ;
6
- use Illuminate \Database \Eloquent \Model ;
7
- use Tepuilabs \SimpleCrm \Models \Enums \ProjectStatus ;
6
+ use Tepuilabs \SimpleCrm \Enums \Project \ProjectStatus ;
8
7
use Tepuilabs \SimpleCrm \Models \Project ;
9
8
10
9
class ProjectFactory extends Factory
11
10
{
12
11
/**
13
12
* The name of the factory's corresponding model.
14
13
*
15
- * @var class-string<Model>
14
+ * @var class-string<\Illuminate\Database\Eloquent\ Model>
16
15
*/
17
16
protected $ model = Project::class;
18
17
@@ -24,51 +23,70 @@ class ProjectFactory extends Factory
24
23
public function definition (): array
25
24
{
26
25
return [
27
- 'title ' => $ this ->faker ->jobTitle () ,
28
- 'description ' => $ this ->faker ->paragraphs () ,
26
+ 'title ' => $ this ->faker ->jobTitle ,
27
+ 'description ' => $ this ->faker ->paragraph ,
29
28
'deadline ' => $ this ->faker ->date (),
30
- 'status ' => $ this ->faker ->randomElement ([
31
- ProjectStatus::OPEN (),
32
- ProjectStatus::CANCELED (),
33
- ProjectStatus::WIP (),
34
- ProjectStatus::BLOCKED (),
35
- ProjectStatus::COMPLETED (),
36
- ])
29
+ 'status ' => $ this ->faker ->randomElement (ProjectStatus::values ()),
37
30
];
38
31
}
39
32
40
- public function statusOpen ()
33
+ /**
34
+ * Indicate that the project status is open.
35
+ *
36
+ * @return \Illuminate\Database\Eloquent\Factories\Factory
37
+ */
38
+ public function statusOpen (): Factory
41
39
{
42
40
return $ this ->state ([
43
- 'status ' => ProjectStatus::OPEN ()
41
+ 'status ' => ProjectStatus::OPEN (),
44
42
]);
45
43
}
46
44
47
- public function statusCanceled ()
45
+ /**
46
+ * Indicate that the project status is canceled.
47
+ *
48
+ * @return \Illuminate\Database\Eloquent\Factories\Factory
49
+ */
50
+ public function statusCanceled (): Factory
48
51
{
49
52
return $ this ->state ([
50
- 'status ' => ProjectStatus::CANCELED ()
53
+ 'status ' => ProjectStatus::CANCELED (),
51
54
]);
52
55
}
53
56
54
- public function statusWip ()
57
+ /**
58
+ * Indicate that the project status is work in progress.
59
+ *
60
+ * @return \Illuminate\Database\Eloquent\Factories\Factory
61
+ */
62
+ public function statusWip (): Factory
55
63
{
56
64
return $ this ->state ([
57
- 'status ' => ProjectStatus::WIP ()
65
+ 'status ' => ProjectStatus::WIP (),
58
66
]);
59
67
}
60
68
61
- public function statusBlocked ()
69
+ /**
70
+ * Indicate that the project status is blocked.
71
+ *
72
+ * @return \Illuminate\Database\Eloquent\Factories\Factory
73
+ */
74
+ public function statusBlocked (): Factory
62
75
{
63
76
return $ this ->state ([
64
- 'status ' => ProjectStatus::BLOCKED ()
77
+ 'status ' => ProjectStatus::BLOCKED (),
65
78
]);
66
79
}
67
80
68
- public function statusCompleted ()
81
+ /**
82
+ * Indicate that the project status is completed.
83
+ *
84
+ * @return \Illuminate\Database\Eloquent\Factories\Factory
85
+ */
86
+ public function statusCompleted (): Factory
69
87
{
70
88
return $ this ->state ([
71
- 'status ' => ProjectStatus::COMPLETED ()
89
+ 'status ' => ProjectStatus::COMPLETED (),
72
90
]);
73
91
}
74
92
}
0 commit comments