It seems like you've set up the repeater correctly according to the Filament documentation. However, if the sort order is not saving, there are a few things you should check:
-
Ensure that the
sortcolumn exists in yourperiodical_articlestable and that it is of a type that can store an integer value (e.g.,INTEGER). -
Make sure that you are not overriding the
savemethod in your Filament resource or doing anything that could interfere with the saving process of the repeater items. -
Verify that the
sortcolumn is fillable in yourPeriodicalArticlemodel. You should have something like this in your model:
class PeriodicalArticle extends Model
{
protected $fillable = ['title', 'author', 'type', 'sort'];
// ...
}
-
If you have any custom logic in the
savingorsavedmodel events (in yourPeriodicalArticlemodel), ensure that it does not interfere with the sorting. -
Check if there are any JavaScript errors in your browser's console when you try to reorder the items. JavaScript errors could prevent the new order from being submitted correctly.
-
Ensure that you are using the latest version of Filament, as there might have been bug fixes related to the repeater functionality.
If everything seems to be in order and you're still facing issues, you might want to debug by listening to the saving event on the PeriodicalArticle model to see if the sort values are being set correctly:
PeriodicalArticle::saving(function ($periodicalArticle) {
\Log::info('Saving periodical article with sort order: ' . $periodicalArticle->sort);
});
This will log the sort order every time a PeriodicalArticle is saved. You can check your log files to see if the sort order is being captured correctly.
If you've gone through all these steps and the issue persists, it might be a good idea to reach out to the Filament community or check the GitHub issues for the project to see if anyone else has reported a similar problem or if there's an ongoing bug that needs to be addressed.