I've a column named people_id
instead of user_id
, so when I run my query in laravel it throws this error
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'user_id' in 'field list' (SQL: insert into `questions` (`user_id`, `created_at`) values (2, 2016-10-19 07:07:33))
How can I make it use people_id instead of user_id, assuming name of table is 'people'
My App/User.php file
<?php
namespace App;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
protected $table='people';
protected $fillable = [
'name', 'email', 'password','age'
];
protected $hidden = [
'password', 'remember_token',
];
public function questions() {
return $this->hasMany('App\questions');
}
}