area17 / twill

Twill is an open source CMS toolkit for Laravel that helps developers rapidly create a custom admin console that is intuitive, powerful and flexible. Chat with us on Discord at https://discord.gg/cnWk7EFv8R.
https://twillcms.com
Apache License 2.0
3.71k stars 567 forks source link

Axios breaks datatable filters #2518

Closed florianschrottenloher-iu closed 5 months ago

florianschrottenloher-iu commented 5 months ago

Description

The Axios update to v0.28.0 had some breaking changes in parameter serialization. Objects and Arrays are now provided in a bracket style instead of an object style:

New: &filter[status]=published Old: &filter={"status":"published"}

This change leads to json_decode errors in src/Http/Controllers/Admin/ModuleController.php due to Twill expecting a json_decodeable string attached to the "filter" request parameter.

Object { message: "json_decode(): Argument #1 ($json) must be of type string, array given", exception: "TypeError", file: "./vendor/area17/twill/src/Http/Controllers/Admin/ModuleController.php", line: 2135}

Steps to reproduce

Expected result

Actual result

Versions

Twill 3.2.0

Tofandel commented 5 months ago

There is a possibility it's breaking more than this

I didn't dig into it but titles are saved like this image

After digging, it's completely unrelated just missed a $field = in $field = parent::prepareFieldsBeforeSave($object, $fields);