I keep getting the error
"SQLSTATE[42S22]: Column not found: 1054 Unknown column '' in 'where clause' "
with the sql output:
update `contactables` set `updated_at` = 2019-08-16 20:35:56, `active` = 0 where `` is null and `key_ID` = 235852
I was attempting to use the eloquent firstOrNew/firstOrCreate method on a polymorphic model. I've tried all sorts of variants of this:
$record1 = Contactable::firstOrNew(
[
'contactable_ID' => $location_ID,
'user_ID' => $user_ID,
'contactable_type' => Location::class,
]);
$record = Contactable::find($record1->key_ID);
$record->fill(
[
'active' => $active,
]);
$record->save();
$primaryKey = 'key_ID';
$guarded = [];
$fillable = [
'user_ID',
'use_loc_contact_info',
'contactable_ID',
'contactable_type',
'active',
'flag',
'print_and_save',
'marketing',
];
This appears to only happen when trying to update a record where I actually change something. Creating records seems to work fine, updating where I don't change anything seems to work. I'm at a total loss as to what to do next...
I've looked at these (and a dozen+ others that weren't really related):
Laravel eloquent firstOrNew method doesn't update or insert
Thanks for any help, or new questions!