Open Patus opened 2 years ago
Hey, I don't think composite keys are supported in Laravel.
Got the same kind of issue. You can define a array as key type in laravel.
public function getKeyType() { return 'array'; }
When we disable clockwork this works fine, but if we enable it this error is thrown. So clockwork changes in some kind of way the $key values of setAttribute from string to the primary key. Illegal offset type in isset or empty
Hey, the Laravel documentation only mentions int
and string
as possible values for the key type.
This issues is more that clockwork changes the type of the value. I liked clockwork, so i maybe create a fork thats supports the the array as primary key type
If you look at the stack trace, the crash happens somewhere in the Eloquent code, when Clockwork calls $model->getKey()
, which should return the primary key value.
In my case using Illuminate\Database\Eloquent\Relations\Pivot
instead Illuminate\Database\Eloquent\Model
as parent class for model has resolve problem
Hello,
When making query with entries.entry where model has hasMany relationship to other model and Entries model has two primary keys. I get error:
array_key_exists(): The first argument should be either a string or an integer at ...vendor\\laravel\\framework\\src\\Illuminate\\Database\\Eloquent\\Concerns\\HasAttributes.php:321)
example:
Model::with( 'entries.entry' )->get();
Model:
entries model:
protected $primaryKey = ['id', 'entry_id'];
Laravel 6 clockwork 5.1
Error: