@@ -32,8 +32,12 @@ public function __construct(
32
32
protected ?FakerMediaLocal $ mediaLocal = null ,
33
33
protected ?FakerMediaDownloader $ mediaDownloader = null ,
34
34
protected ?FakerJson $ json = null ,
35
- ) {}
35
+ ) {
36
+ }
36
37
38
+ /**
39
+ * Clear `storage/app/public` and `storage/app/download` directories before seeding.
40
+ */
37
41
public static function beforeSeed (): bool
38
42
{
39
43
$ paths = [
@@ -50,12 +54,18 @@ public static function beforeSeed(): bool
50
54
return true ;
51
55
}
52
56
57
+ /**
58
+ * Run `scout:fresh` and `media:clean` commands after seeding.
59
+ */
53
60
public static function afterSeed (): void
54
61
{
55
62
Artisan::call (ScoutFreshCommand::class);
56
63
Artisan::call (MediaCleanCommand::class, ['--force ' => true ]);
57
64
}
58
65
66
+ /**
67
+ * Create a new instance of the service.
68
+ */
59
69
public static function make (string |\UnitEnum |null $ mediaPath = null ): self
60
70
{
61
71
$ generator = \Faker \Factory::create ();
@@ -70,6 +80,9 @@ public static function make(string|\UnitEnum|null $mediaPath = null): self
70
80
return $ service ;
71
81
}
72
82
83
+ /**
84
+ * Create a new instance of the service without search.
85
+ */
73
86
public static function noSearch (string $ model , Closure $ closure ): mixed
74
87
{
75
88
$ item = ClassParserItem::make ($ model );
@@ -81,6 +94,9 @@ public static function noSearch(string $model, Closure $closure): mixed
81
94
return $ model ::withoutSyncingToSearch (fn () => $ closure ());
82
95
}
83
96
97
+ /**
98
+ * `text()` and `richText()` factories.
99
+ */
84
100
public function useText (?FakerTextEnum $ type = null ): self
85
101
{
86
102
$ this ->text = $ this ->setFakerText ($ type );
@@ -89,21 +105,41 @@ public function useText(?FakerTextEnum $type = null): self
89
105
return $ this ;
90
106
}
91
107
108
+ /**
109
+ * Get the generator instance.
110
+ */
92
111
public function generator (): Generator
93
112
{
94
113
return $ this ->generator ;
95
114
}
96
115
116
+ /**
117
+ * @deprecated Use `generator()` method instead.
118
+ */
119
+ public function faker (): Generator
120
+ {
121
+ return $ this ->generator ();
122
+ }
123
+
124
+ /**
125
+ * Get the text factory instance.
126
+ */
97
127
public function text (): FakerText
98
128
{
99
129
return $ this ->text ;
100
130
}
101
131
132
+ /**
133
+ * Get the rich text factory instance.
134
+ */
102
135
public function richText (): FakerRichText
103
136
{
104
137
return $ this ->richText ;
105
138
}
106
139
140
+ /**
141
+ * Get the date time factory instance.
142
+ */
107
143
public function dateTime (): FakerDateTime
108
144
{
109
145
return $ this ->dateTime ;
0 commit comments