Answer the question
In order to leave comments, you need to log in
Why doesn't Sluggable work from within a package?
I have a Category model and it uses use Cviebrock\EloquentSluggable\Sluggable;
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Spatie\Translatable\HasTranslations;
use Cviebrock\EloquentSluggable\Sluggable;
use Kalnoy\Nestedset\NodeTrait;
class Category extends Model
{
use HasTranslations;
use NodeTrait, Sluggable {
Sluggable::replicate as replicateSluggable;
NodeTrait::replicate insteadof Sluggable;
}
public $translatable = ['name'];
protected $table = 'categories';
protected $fillable = ['name', 'slug', 'parent_id', 'owner'];
public function sluggable()
{
return [
'slug' => [
'source' => 'name'
]
];
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question