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)



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1XpYZ4v
via IFTTT

Aucun commentaire:

Enregistrer un commentaire