laravel slug

67

use Illuminate\Support\Str;

$slug = Str::slug('Laravel 5 Framework', '-');

// laravel-5-framework
$ composer require cviebrock/eloquent-sluggable
public function setTitleAttribute($value)
{
    $this->attributes['title'] = $value;
    $this->attributes['slug'] = str_slug($value);
}
php artisan vendor:publish --provider="Cviebrock\EloquentSluggable\ServiceProvider"

Comments

Submit
0 Comments