'Test Blog Post ' . $i, 'content' => $article, 'location' => null, 'created_at' => Carbon::today()->subDays(rand(1, 100)) ])->create()->tags()->saveMany(Tag::inRandomOrder()->limit(random_int(1, 3))->get()); } BlogPost::factory([ 'title' => 'Test Blog Post 1', 'content' => $article, 'location' => null, 'created_at' => Carbon::today()->subDays(rand(1, 100)) ])->create()->tags()->saveMany(Tag::inRandomOrder()->limit(random_int(1, 3))->get()); BlogPost::factory([ 'title' => 'Blog Post Test 2', 'content' => $article, 'location' => null, 'created_at' => Carbon::today()->subDays(rand(1, 100)) ])->create()->tags()->saveMany(Tag::inRandomOrder()->limit(random_int(1, 3))->get()); } }