DEV Community

Morcos Gad
Morcos Gad

Posted on

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)