i got some error like this :
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'tbl_user.id' in 'where clause' (SQL: select * from `tbl_user` where `tbl_user`.`id` = 1 limit 1)
the query search 'id' column when my column name is not 'id' but 'id_user',
i want ask how to edit the code from
select * from `tbl_user` where `tbl_user`.`id` = 1 limit 1
on laravel to :
select * from `tbl_user` where `tbl_user`.`id_user` = 1 limit 1
this is my migration..
public function up()
{
Schema::create('tbl_user', function (Blueprint $table) {
$table->increments('id_user');
$table->string('nama_user', 50);
$table->string('level_akses', 30);
$table->string('status', 7)->default('offline');
$table->string('contact', 14);
$table->string('eMail', 70);
$table->string('password', 30);
$table->timestamps();
});
}
Specify the primary key in your model:
protected $primaryKey = 'id_user';
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community