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 | The model used by the child factory class. |
from Factory |
| protected array | $states | States for overriding definition. |
from Factory |
Methods
Sets the model to the application's configured user model so created
records are instances of App\Models\Users (or whatever
auth.user_model points to), not the base User class.
Definition for UsersFactory.
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 reset_password.
State callback for generating profile images.
Details
at line 18
__construct()
Sets the model to the application's configured user model so created
records are instances of App\Models\Users (or whatever
auth.user_model points to), not the base User class.
at line 41
protected array
definition()
Definition for UsersFactory.
in
Factory at line 71
Factory
afterCreating(callable $callback)
Adds callback to afterCreatingCallbacks array.
in
Factory at line 82
protected string
append()
Helper function for satisfying complexity or length requirements.
in
Factory at line 99
array|object
create(array $attributes = [])
Create a record(s) in the database.
in
Factory at line 127
protected Factory
configure()
Configure function used for registering afterCreating callbacks.
in
Factory at line 137
Factory
count(int $count)
Specify number of records to insert into the database.
in
Factory at line 149
static Factory
factory(mixed ...$params)
Returns instance of new child factory class.
in
Factory at line 161
protected object|null
insert(array $data, string $modelName)
Insert data into the database table.
in
Factory at line 194
protected void
invokeAfterCreatingCallbacks(object $model)
Calls all registered afterCreating callbacks associated with a factory.
in
Factory at line 209
protected array
invokeStateCallbacks(array $attributes, array $data)
Calls state callback functions.
in
Factory at line 238
Factory
state(callable $state)
Manages state for values of keys that should be overridden by state functions.
at line 28
UserFactory
admin()
Overrides default value for acl.
at line 69
UserFactory
deleted()
Overrides default value for deleted.
at line 82
UserFactory
inactive()
Overrides default value for inactive.
at line 94
UserFactory
loginAttempts()
Overrides default value for login_attempts.
at line 107
UserFactory
resetPassword()
Overrides default value for reset_password.
at line 121
UserFactory
withImages(int $count = 2)
State callback for generating profile images.