Laravel str pluralStudly() function Example

Admin   Laravel   209  2021-03-14 10:10:05

Hi Guys,

In this blog,I will you how to use laravel str pluralStudly() function example. We will show example of pluralStudly function in laravel.The Str::pluralStudly method converts a singular word string formatted in studly caps case to its plural form. This function currently only supports the English language.

Here, I will give you full example for simply str pluralStudly() method in laravel as bellow.

solution

 

$pluralStudly1 = Str::pluralStudly('VerifiedHuman');

print_r($pluralStudly1);

// output - VerifiedHumans

$pluralStudly2 = Str::pluralStudly('UserFeedback');

print_r($pluralStudly2);

// output - UserFeedback

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()

{

$pluralStudly1 = Str::pluralStudly('VerifiedHuman');

print_r($pluralStudly1);

// output - VerifiedHumans

$pluralStudly2 = Str::pluralStudly('UserFeedback');

print_r($pluralStudly2);

// output - UserFeedback

}

}

Output

 

VerifiedHumans

UserFeedback

It Will help you...