4 years ago

Eloquent Sluggable

Posted 4 years ago by spoon



I'm trying to install the package above. But when I add implements like below, PhpStorm gives an error states that "class must be declared abstract or implement methods resluggify, sluggify, getSlug". Is the docs old?

Here's my model. (it's in Models folder so I use a namespace)

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Cviebrock\EloquentSluggable\SluggableInterface;
use Cviebrock\EloquentSluggable\SluggableTrait;

class Thing extends Model implements SluggableInterface
    protected $table = 'thing';
    protected $primaryKey = 'thing_id';

    protected $sluggable = [
      'build_from' => 'original_title',
      'save_to'    => 'slug',

I also added it to my config/app.php like below. Cviebrock\EloquentSluggable\SluggableServiceProvider::class

I'm still new to Laravel5 and OOP PHP, trying to learn.

Please sign in or create an account to participate in this conversation.