From bc60b2598f9244122db86131207a6a86cb80b5f5 Mon Sep 17 00:00:00 2001 From: Moamen Eltouny Date: Tue, 27 Apr 2021 13:50:07 +0200 Subject: [PATCH] add README --- README.md | 113 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) diff --git a/README.md b/README.md index 8b13789..0378bb1 100644 --- a/README.md +++ b/README.md @@ -1 +1,114 @@ +

+ +

+Source Packagist Version
+Laravel Packagist Downloads Source +

+ + + + +

Laravel Sluggable

+ +## Install + +`Hint` Laravel Sluggable requires the Multibyte String `mbstring` extension from PHP.
+`Hint` Mainly depends on [Pharaonic/PHP-Slugify](https://github.com/Pharaonic/php-slugify)

+Install the latest version using [Composer](https://getcomposer.org/): + +```bash +$ composer require pharaonic/laravel-sluggable +``` +
+ +## Usage Steps + +- [Create a slug column on the table](#CS) +- [Sluggable with the model](#US) +- [How to use](#HTU) +- [Config Manipulation](#CM) +

+ + + +### Create a slug column on the table +###### Just add this line to your Migration file. +```php +$table->sluggable(); +``` +
+ + +### Sluggable with the model +```php +IT RUNS AUTOMATICALLY DEPENDS ON CONFIG. +
+ + + +### How To Use +###### Simply create/update your object. +```php +$article = Article::create(['title' => 'Moamen Eltouny']); +echo $article->slug; +``` +
+ + + +### Config Manipulation +```bash +$ php artisan vendor:publish --tag="laravel-sluggable" +``` +##### You can find your config file in that path `/config/Pharaonic/sluggable.php`. + +```php + true, + + // Generate slug on Eloquent Create + 'onCreate' => true, + + // Generate slug on Eloquent Update + 'onUpdate' => true +]; + +``` +

+ + + +## License + +[MIT license](LICENSE.md)