UserFactory
class UserFactory extends Factory
Factory for creating new user table records.
Properties
| protected array | $afterCreatingCallbacks | Array containing callbacks that are used after database record is successfully saved. |
from Factory |
| protected int | $count | Value for how many insertions to be performed by factory. |
from Factory |
| protected FactoryFaker | $faker | Instance of Faker\Factory object. |
from Factory |
| protected string | $modelName | ||
| protected array | $states | States for overriding definition. |
from Factory |
Methods
Constructor for Faker class. Should be called by any child class that overrides this constructor.
Define the model's default state.
Adds callback to afterCreatingCallbacks array.
Insert data into the database table.
Calls all registered afterCreating callbacks associated with a factory.
Calls state callback functions.
Manages state for values of keys that should be overridden by state functions.
Overrides default value for acl.
Overrides default value for deleted.
Overrides default value for inactive.
Overrides default value for login_attempts.
Overrides default value for resetPassword.
State callback for generating profile images.
Details
in
Factory at line 52
__construct()
Constructor for Faker class. Should be called by any child class that overrides this constructor.
at line 32
protected array
definition()
Define the model's default state.
in
Factory at line 70
Factory
afterCreating(callable $callback)
Adds callback to afterCreatingCallbacks array.
in
Factory at line 81
protected string
append()
Helper function for satisfying complexity or length requirements.
in
Factory at line 97
array|object
create(array $attributes = [])
Create a record(s) in the database.
in
Factory at line 125
protected Factory
configure()
Configure function used for registering afterCreating callbacks.
in
Factory at line 135
Factory
count(int $count)
Specify number of records to insert into the database.
in
Factory at line 147
static Factory
factory(mixed ...$params)
Returns instance of new child factory class.
in
Factory at line 159
protected object|null
insert(array $data, string $modelName)
Insert data into the database table.
in
Factory at line 192
protected void
invokeAfterCreatingCallbacks(object $model)
Calls all registered afterCreating callbacks associated with a factory.
in
Factory at line 207
protected array
invokeStateCallbacks(array $attributes, array $data)
Calls state callback functions.
in
Factory at line 236
Factory
state(callable $state)
Manages state for values of keys that should be overridden by state functions.
at line 19
UserFactory
admin()
Overrides default value for acl.
at line 60
UserFactory
deleted()
Overrides default value for deleted.
at line 73
UserFactory
inactive()
Overrides default value for inactive.
at line 85
UserFactory
loginAttempts()
Overrides default value for login_attempts.
at line 98
UserFactory
resetPassword()
Overrides default value for resetPassword.
at line 112
UserFactory
withImages(int $count = 2)
State callback for generating profile images.