DEV Community

Morcos Gad
Morcos Gad

Posted on

1

New In Laravel - 8.72.0

Support for countables to the pluralizer

use Illuminate\Support\Str;
use App\Models\User;

$users = User::take(1)->get();
return Str::plural('user', $users->count()); //user

$users = User::take(2)->get();
return Str::plural('user', $users->count()); //users
Enter fullscreen mode Exit fullscreen mode

I hope you enjoy the code.

Top comments (0)

Image of Checkly

Replace beforeEach/afterEach with Automatic Fixtures in Playwright

  • Avoid repetitive setup/teardown in spec file
  • Use Playwright automatic fixtures for true global hooks
  • Monitor JS exceptions with a custom exceptionLogger fixture
  • Keep your test code clean, DRY, and production-grade

Watch video

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, valued within the supportive DEV Community. Coders of every background are welcome to join in and add to our collective wisdom.

A sincere "thank you" often brightens someone’s day. Share your gratitude in the comments below!

On DEV, the act of sharing knowledge eases our journey and fortifies our community ties. Found value in this? A quick thank you to the author can make a significant impact.

Okay