FactoryBuilder (Database\Eloquent)
FactoryBuilder
class FactoryBuilder (View source)
Traits
Macroable |
Methods
static void | macro(string $name, callable $macro) Register a custom macro. | from Macroable |
static bool | hasMacro(string $name) Checks if macro is registered. | from Macroable |
static mixed | __callStatic(string $method, array $parameters) Dynamically handle calls to the class. | from Macroable |
mixed | __call(string $method, array $parameters) Dynamically handle calls to the class. | from Macroable |
void | __construct(string $class, string $name, array $definitions, array $states, Generator $faker) Create an new builder instance. | |
$this | times(int $amount) Set the amount of models you wish to create / make. | |
$this | states(array|mixed $states) Set the states to be applied to the model. | |
Closure | lazy(array $attributes = array()) Create a model and persist it in the database if requested. | |
mixed | create(array $attributes = array()) Create a collection of models and persist them to the database. | |
mixed | make(array $attributes = array()) Create a collection of models. | |
mixed | raw(array $attributes = array()) Create an array of raw attribute arrays. |
Details
static void macro(string $name, callable $macro)
Register a custom macro.
static bool hasMacro(string $name)
Checks if macro is registered.
static mixed __callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
mixed __call(string $method, array $parameters)
Dynamically handle calls to the class.
void __construct(string $class, string $name, array $definitions, array $states, Generator $faker)
Create an new builder instance.
$this times(int $amount)
Set the amount of models you wish to create / make.
$this states(array|mixed $states)
Set the states to be applied to the model.
Closure lazy(array $attributes = array())
Create a model and persist it in the database if requested.
mixed create(array $attributes = array())
Create a collection of models and persist them to the database.
mixed make(array $attributes = array())
Create a collection of models.
mixed raw(array $attributes = array())
Create an array of raw attribute arrays.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.4/Illuminate/Database/Eloquent/FactoryBuilder.html