Home > Enterprise >  Laravel Model primary key change error Illegal offset type
Laravel Model primary key change error Illegal offset type

Time:07-16

The illegal offset type shows this error when

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

CodePudding user response:

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

protected $primaryKey = 'user_id';
  • Related