Unique slug generator for laravel Eloquent Model.
composer require billal4b/laravel-unique-slug
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
php artisan vendor:publish billal4b/laravel-unique-slug
You are open to create any pull request.