Declaration of App\Models\Post::sluggable() must be compatible with Cviebrock\EloquentSluggable\Sluggable

Updated at 02-Mar-2022, By samar

Declaration of AppModelsPost::sluggable() must be compatible with CviebrockEloquentSluggableSluggable

We’ll attempt to use programming in this lesson to solve the "Declaration of AppModelsPost::sluggable() must be compatible with CviebrockEloquentSluggableSluggable" puzzle.

You have to add : array with sluggable() to remove error Declaration of App\Models\Post::sluggable() must be compatible with Cviebrock\EloquentSluggable\Sluggable::sluggable(): array
  • Add : array to sluggable()

    --PATH app\Models\Post.php
    public function sluggable(): array
    {
        return [
            'slug' => [
                'source' => 'title'
            ],
        ];
    }
    

Back to code snippet queries related laravel