laravel uuid helper 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: uuid package generator laravel

//above in controller
use Illuminate\Support\Str;

//in function
$uuid = Str::uuid()->toString();

//terminal
composer require "webpatser/laravel-uuid:^3.0"

Example 3: laravel str::random

use Illuminate\Support\Str;

$random = Str::random(40);

Example 4: uuid in laravel

use Illuminate\Support\Str;

$uuid = Str::uuid()->toString();

Tags:

Php Example