Laravel 5.2 auth change ‘id’ to ‘customer_id’

In this topic I asked a question: laravel 5.2 auth change ‘users’ table

But now my problem has changed. By default the users table has an id. But I want a customer_id, so I changed everything but it don’t work. It keeps asking for an id.

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

In the table klanten I have a customer_id, but it keeps asking for an id.

Things I’ve changed:

config/auth


'providers' => [
'users' => [
'driver' => 'eloquent',
'model' => AppUser::class,
'table' => 'klanten',
],

created a klanten migration


public function up()
{
Schema::create('klanten', function (Blueprint $table) {
$table->increments('klant_id');
$table->string('voornaam');
$table->string('email')->unique();
$table->string('password', 64);
$table->rememberToken();
$table->boolean('status');
$table->timestamps();
});
}

If I remove timestamps it keeps asking for created_at and updated_at too.

Controllers/Auth/AuthController


protected function validator(array $data)
{
return Validator::make($data, [
'voornaam' => 'required|max:255',
'email' => 'required|email|max:255|unique:klanten',
'password' => 'required|confirmed|min:6',
]);
}

protected function create(array $data)
{
return User::create([
'voornaam' => $data['voornaam'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
]);
}

app/User


protected $table = 'klanten';

protected $fillable = [
'voornaam', 'email', 'password',
];

I hope somebody can help me!

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

Related Posts

Codeigniter : Parse error: syntax error, unexpected ‘const’ (T_CONST), expecting variable (T_VARIABLE) in Laravel project

I’m getting following error: **Parse error: syntax error, unexpected ‘const’ (T_CONST), expecting variable (T_VARIABLE)** Note : It’s working in local but facing issue in production server. private…

Firebase receive notification while tab is active or on focus

What i want is to be able to perform an action when a user receives a notification while the browser is open and tab is active or…

Laravel’s alias loader does not find class

We have a legacy project that we cannot update and we need to make some changes in symfony’s Response.php in vendor. We have solved this by copying…

Laravel 5 – generic document management

I have a system where you can create different types of unique documents. For instance, one document is called Project Identified and this expects certain inputs. Originally,…

Laravel Nova limit the results in indexQuery

I ran intro a situation where I need to limit the results of a resource to only 3 results. To be more specific, based on the logged…

Auditoria en laravel 5.8 [closed]

Cómo puedo automatizar el registro de actividades de un usuario en laravel? Si un usuario ingresa a un app de laravel, debo guardar toda su actividas, a…

Leave a Reply

Your email address will not be published.