Using Laravel 5.4.13, I have a model called Widget, where I set the primary key like this:
protected $primaryKey = 'widget_id';
The widgets table has a primary key column, int, auto-increment, named: widget_id.
Yet, when I try to update a record on the browser I get this error:
QueryException in Connection.php line 647:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'id' in 'where clause' (SQL: select count(*) as aggregate from widgets
where name
= est eum and id
<> 3)
It still looks for a column called: id and not widget_id.
What am I missing?
via Sigal Zahavi