-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Closed
Description
- Laravel Version: 7.11.0
- PHP Version: 7.4.4
- Database Driver & Version: MySql 5.7
Description:
model $attributes
gives error when I try to use Model::firstOrCreate()
Steps To Reproduce:
I have this on a model:
protected $attributes = [
'invoicing' => [
'calc_due_days_from' => 'invoice_date',
'invoice_date_num_days' => 30,
'before_start_num_days' => 48,
'currency_code' => 'SEK',
'currency_symbol' => 'kr',
'invoice_note' => null,
'inv_prefix' => null,
'inv_suffix' => null,
'inv_counter' => null,
'cred_note' => null,
'cred_prefix' => null,
'cred_suffix' => null,
'cred_counter' => null,
],
];
It works great with new Model
but I get an error if I try to use firstOrCreate()
Error in TinkerWell
Argument 1 passed to Illuminate/Database/Grammar::parameterize() must be of the type array, string given, called in /Users/tina/Sites/bookons-api/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/Grammar.php on line 866
Error in Horizon (I am trying to make a batch import)
ErrorException: json_decode() expects parameter 1 to be string, array given in /Users/tina/Sites/bookons-api/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php:811
If I comment out the attributes I can use firstOrCreate() without any problem.
Metadata
Metadata
Assignees
Labels
No labels