Create models without dispatching any events

Sometimes you may wish to update a given model without dispatching any events. You may accomplish this using the updateQuietly method

1Post::factory()->createOneQuietly();
2 
3Post::factory()->count(3)->createQuietly();
4 
5Post::factory()->createManyQuietly([
6 ['message' => 'A new comment'],
7 ['message' => 'Another new comment'],
8]);

Like our articles?

Become a Premium Member for $129/year or $29/month
What else you will get:
  • 22 courses (477 lessons, total 38 h 20 min)
  • 2 long-form tutorials (one new every week)
  • access to project repositories
  • access to private Discord