Skip to content

amdad121/unique-slug-laravel

Repository files navigation

Unique slug generator for Laravel

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This is simple unique slug generator package for Laravel. It is easy to use your any Laravel project.

Installation

You can install the package via composer:

composer require amdad121/unique-slug-laravel

Usage

namespace App\Models;

use AmdadulHaq\UniqueSlug\HasSlug;
// ...

class User extends Authenticatable
{
    use HasSlug;

    // Optionally you can configure
    public function getSlugSourceAttribute(): string
    {
        return 'name'; // Default attribute to generate slug from
    }

    public function getSlugAttribute(): string
    {
        return 'slug'; // Default attribute to store the slug
    }

    public function getSlugSeparator(): string
    {
        return '-'; // Default separator for the slug
    }
}

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages