Laravel Model primary key change error Illegal offset type

Viewed 42

The illegal offset type shows this error when

protected $primaryKey = ['user_id'];
public $incrementing = false;
1 Answers

The primaryKey takes a string not array all you need is to change it to string

protected $primaryKey = 'user_id';
Related