mercredi 21 septembre 2016

Laravel 5.3 ignores $primaryKey

I have a table with primary key group_id.

I have this in the model: protected $primaryKey = 'group_id';

In my update method I have:

'group_name' => 'required|string|unique:groups,group_name,' .$id,

The query executed is looking column id in the table instead of group_id.

SQLSTATE[42S22]: Column not found: 1054 Champ 'id' inconnu dans where clause (SQL: select count(*) as aggregate from groups where group_name = Clarens Community Forum and id <> 1)

Why is that?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire