INIT
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Database\Eloquent\Factories;
|
||||
|
||||
trait HasFactory
|
||||
{
|
||||
/**
|
||||
* Get a new factory instance for the model.
|
||||
*
|
||||
* @param callable|array|int|null $count
|
||||
* @param callable|array $state
|
||||
* @return \Illuminate\Database\Eloquent\Factories\Factory<static>
|
||||
*/
|
||||
public static function factory($count = null, $state = [])
|
||||
{
|
||||
$factory = static::newFactory() ?: Factory::factoryForModel(get_called_class());
|
||||
|
||||
return $factory
|
||||
->count(is_numeric($count) ? $count : null)
|
||||
->state(is_callable($count) || is_array($count) ? $count : $state);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new factory instance for the model.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Factories\Factory<static>
|
||||
*/
|
||||
protected static function newFactory()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user