dimanche 29 novembre 2015

Retrieving the record by Primary Key is not working in Laravel

Table Schema

Create Table User
(
    UserID int,
    FirstName varchar(50)
)

User Model

class User_Model extends Model
{
    protected $table = "user";
}

Below is my code in Laravel 5

$users = \App\Models\User_Model::find(1);

Error Message

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'user.id' in 'where clause' (SQL: select * from user where user.id = 1 limit 1)



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire