PHP code example of amaz / laravel-unique-slug

1. Go to this page and download the library: Download amaz/laravel-unique-slug library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

amaz / laravel-unique-slug example snippets


use Amaz\LaravelUniqueSlug\Facades\UniqueSlug;

UniqueSlug::generate(App\Models\User::class, 'amaz', 'name');
// amaz

// After creating a new user with name akash, then again hit
UniqueSlug::generate(App\Models\User::class, 'amaz', 'name');
// amaz-1


// After creating a new user with name akash-1, then again hit
UniqueSlug::generate(App\Models\User::class, 'amaz', 'name');
// amaz-2




sh
php artisan vendor:publish amaz/laravel-unique-slug