sluggable laravel code example
Example 1: laravel sluggable
$ composer require cviebrock/eloquent-sluggable
Example 2: laravel sluggable
use Cviebrock\EloquentSluggable\Sluggable;
class Post extends Model
{
use Sluggable;
/**
* Return the sluggable configuration array for this model.
*
* @return array
*/
public function sluggable()
{
return [
'slug' => [
'source' => 'title'
]
];
}
}
Example 3: laravel slug
php artisan vendor:publish --provider="Cviebrock\EloquentSluggable\ServiceProvider"