Hello Devs, 

In this tutorial, we will learn Laravel str plural() function Example

The Str::plural method converts a single-word string to its plural form. This function currently only supports the English language:

Follow this step-by-step guide below. 



Example:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Http\Controllers\FileController;
use Illuminate\Support\Str;

class HomeController extends Controller
{
    /**
     * Show the application dashboard.
     *
     * @return \Illuminate\Contracts\Support\Renderable
     */
    public function index()
    {
        $plural1 = Str::plural('boy');
        
        dd($plural1);
        // output - boys

        $plural2 = Str::plural('car');
        
        dd($plural2);
        // output - cars

        $plural3 = Str::plural('child');

        dd($plural3);
        // output - children

    }
}


Output :

"boys"
"cars"
"children"


May this example help you.