rogermedico / factory-without-events
Allows to create Laravel factory without the previously defined afterCreating or afterMaking callbacks.
1.0
2024-02-13 11:23 UTC
Requires
- php: ^8.0
- illuminate/database: ^8.0|^9.0|^10.0
Requires (Dev)
- fakerphp/faker: ^1.23
- mockery/mockery: ^1.6
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^10.5
README
This repo can be used to make or create Laravel factories without execution of previously created afterMaking and afterCreating callbacks.
Installation
You can install the package via composer:
composer require rogermedico/factory-without-events
Usage
Make your factory as usual and add the WithoutEvents trait to it. Then in your code if you want to make/create a factory without executing afterMake or afterCreate callbacks do it like this:
$user = User::factory() ->withoutEvents() ->create();
Credits
License
The MIT License (MIT). Please see License File for more information.