Run factories without dispatching events

If you want to create multiple records using Factory without firing any Events, you can wrap your code inside a withoutEvents closure.

$posts = Post::withoutEvents(function () {
return Post::factory()->count(50)->create();
});

Tip given by @TheLaravelDev

Recent New Courses