while (Post::where('slug', $slug)->exists()) { $slug = $base.'-'.++$i; }