This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

daftspunky
daftspunky

The save() method of a model will change in the next build (273+). This is an undocumented feature and it should be rarely used, however, some areas of the core files used it and just in case this pattern was copied, we want to announce this change.

The change is actually a fix since the method was not compatible with Eloquent. In October, the first argument was used to pass in the save data. In Eloquent, the first argument is used to pass in saving options. This was a mistake that was not picked up since the early days, so we are correcting it to ensure compatibility with Laravel and its packages.

Please check your code for instances of ->save() and ensure the first argument is not being used for save data, otherwise this data will be ignored in the upcoming build. Below is how to patch your code if you do discover it. You can patch the code immediately and do not need to wait for the latest build.

Here is the old way:

$data = [...];
$model->save($data);

Here is the new way:

$data = [...];
$model->fill($data);
$model->save();

Last updated

gfactor
gfactor

Hi @daftpunk, am using build 292 and I called the fill() method the way you specified above & I got this error

"Call to a member function fill() on a non-object"

Am using it on an onUpdate() method inside a component.

Last updated

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.