cviebrock / eloquent-sluggable

Easy creation of slugs for your Eloquent models in Laravel
MIT License
3.91k stars 461 forks source link

throw new \UnexpectedValueException #590

Closed Malek-fadel closed 1 year ago

Malek-fadel commented 1 year ago

UnexpectedValueException

Sluggable "method" for App\Models\ProductCategory:slug is not callable nor null.

at vendor/cviebrock/eloquent-sluggable/src/Services/SlugService.php:171 167▕ $slug = $slugEngine->slugify($source, $separator); 168▕ } elseif (is_callable($method)) { 169▕ $slug = $method($source, $separator); 170▕ } else { ➜ 171▕ throw new \UnexpectedValueException('Sluggable "method" for ' . get_class($this->model) .':' . $attribute . ' is not callable nor null.'); 172▕ } 173▕ 174▕ $len = mb_strlen($slug); 175▕ if (is_string($slug) && $maxLength && $len > $maxLength) {

  +15 vendor frames

16 database/seeders/ProductCategorySeeder.php:17 Illuminate\Database\Eloquent\Model::__callStatic()

  +7 vendor frames

24 database/seeders/DatabaseSeeder.php:21 Illuminate\Database\Seeder::call()

cviebrock commented 1 year ago

What does your config look like for that model?

cviebrock commented 1 year ago

Closing due to no response. Feel free to re-open or comment if you are still having issues.