SQL >> Database >  >> RDS >> Mysql

Unknown column id in where clause in Laravel oplossen

Eloquent gebruikt standaard id. Als je primaire sleutel anders heet, stel die dan in.

protected $primaryKey = 'SongID';

Gebruik daarna gewoon Song::find(5).

Als het kan, gebruik dan overal id als primary key om Laravel-conventies te volgen.

  1. getGeneratedKeys: "Column ID Not Found" in JDBC oplossen

  2. Een subselect-kolom gebruiken in een SQL WHERE-clausule

  3. Insert-if-not-exists in MySQL, met of zonder primary key

  4. CakePHP 1.3: onbekende kolom in de WHERE-clausule