ozdemirburak / laravel-9-simple-cms

Laravel 9 content management system for starters.
MIT License
686 stars 302 forks source link

Sluggable #126

Closed itsnotyoutoday closed 2 years ago

itsnotyoutoday commented 3 years ago

After I set everything up I get this error.

Symfony\Component\ErrorHandler\Error\FatalError Declaration of App\Base\SluggableModel::sluggable() must be compatible with Cviebrock\EloquentSluggable\Sluggable::sluggable(): array

itsnotyoutoday commented 3 years ago

Well.. I found one thing out.. It had something to do with php8, i switch the site to 7.4 and the main page loads fine.... not sure why

daveinweb commented 3 years ago

Hi, just check out this article solution, it's a improve for Laravel 8

https://laracasts.com/discuss/channels/general-discussion/symfonycomponenterrorhandlererrorfatalerror-declaration-of-appproductsluggable-must-be-compatible-with-cviebrockeloquentsluggablesluggablesluggable-array

Hope this help you

melaniecarr23 commented 2 years ago

Change Line 28 of app/Base/Sluggable.php to:

#[ArrayShape(['slug' => "array"])] public function sluggable(): array

Then retry php artisan cms:initialize --seed

This worked for me on my local and remote machines (using php 8 and laravel 8)

ozdemirburak commented 2 years ago

thanks for reporting @itsnotyoutoday, and sorry for the reply. just committed the fix, thanks to @gingadevs and @melaniecarr23.