str_limit in laravel 7 code example

Example 1: {{Str::limit laravel

{{Str::limit($category->name, 20)}}

if to end 
  
{{Str::limit($category->name, 20, $end='.......')}}
             
or
  
{{\Illuminate\Support\Str::limit($category->name, 20)}}

Example 2: laravel description substring

{{Str::limit($category->name, 20)}}

if to end 
  
{{Str::limit($category->name, 20, $end='.......')}}
             
or
  
{{\Illuminate\Support\Str::limit($category->name, 20)}}

Example 3: laravel str::random

use Illuminate\Support\Str;

$random = Str::random(40);

Example 4: Str::limit laravel

use Illuminate\Support\Str;

$truncated = Str::limit('The quick brown fox jumps over the lazy dog', 20 , ' ...');

// The quick brown fox...

Tags:

Php Example