Fix parameterize() error in Laravel

When developing web applications based on the Laravel framework, the following error may be issued when saving an object:

TypeError: Illuminate\Database\Grammar::parameterize(): Argument #1 ($values) must be of type array, string given, called in /Users/sebastian/dev/adxs/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/Grammar.php on line 886

Unfortunately, this error is not very meaningful. Often the background is that an array of values should be stored in a text field. However, this needs to be configured specifically within Laravel.

In the following example I have an array of skills that I want to store in a text field. To do this, the transformation must be specified in the corresponding model (in this case person) using casts:

[...]
class Person extends Model {

    protected $casts = [
        'skills' => 'array'
    ];

}

After adding the appropriate code, saving the object should work as desired.