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

This package is auto-updated.

Last update: 2025-05-13 14:32:02 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

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.