PHP code example of billal4b / laravel-unique-slug

1. Go to this page and download the library: Download billal4b/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/ */

    

billal4b / laravel-unique-slug example snippets


use Billal\UniqueSlug\Facades\UniqueSlug;


$slug = UniqueSlug::generate(App\Models\Post::class, "First Post", "slug");
// first-post

//After crating a new post with slug First Post, then again hit
$slug = UniqueSlug::generate(App\Models\Post::class, "First Post", "slug");
// first-post-1

//After crating a new post with slug First Post, then again hit
$slug = UniqueSlug::generate(App\Models\Post::class, "First Post", "slug");
// first-post-2
sh
php artisan vendor:publish billal4b/laravel-unique-slug