create()->each(function ($bookmark) { $bookmark->tags()->save(factory(Tag::class)->make()); $now = Carbon::now()->subDays(rand(2, 12)); DB::table('bookmarks') ->where('id', $bookmark->id) ->update([ 'created_at' => $now->toDateTimeString(), 'updated_at' => $now->toDateTimeString(), ]); }); } }