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
Enjoyed This Tip?
Get access to all premium tutorials, video and text courses, and exclusive Laravel resources. Join our community of 10,000+ developers.
Recent Courses
Building a Typical Laravel SaaS
13 lessons
1 h 58 min
Laravel Modules and DDD
16 lessons
1 h 59 min
How to Build Laravel 12 API From Scratch
28 lessons
1 h 21 min