We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e9d9b93 commit 4a95372Copy full SHA for 4a95372
src/Illuminate/Database/Eloquent/Factories/HasFactory.php
@@ -12,8 +12,20 @@ trait HasFactory
12
*/
13
public static function factory(...$parameters)
14
{
15
- return Factory::factoryForModel(get_called_class())
+ $factory = static::newFactory() ?: Factory::factoryForModel(get_called_class());
16
+
17
+ return $factory
18
->count(is_numeric($parameters[0] ?? null) ? $parameters[0] : null)
19
->state(is_array($parameters[0] ?? null) ? $parameters[0] : ($parameters[1] ?? []));
20
}
21
22
+ /**
23
+ * Create a new factory instance for the model.
24
+ *
25
+ * @return \Illuminate\Database\Eloquent\Factories\Factory
26
+ */
27
+ public static function newFactory()
28
+ {
29
+ //
30
+ }
31
0 commit comments