If your column password is big letter. you can use like the following

  1. In your User.php Model we need to override one function in User.php model

 

<?php

namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
use Notifiable;

/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
‘EmailAddress’, ‘Password’,
];

protected $table = ‘Customer’;

/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
‘Password’, ‘remember_token’,
];

public function getAuthPassword()
{
return $this->Password;
}

}

2. Then in your Authentication checking use like the following

if (Auth::attempt([‘EmailAddress’ => ‘test@gmail.com’, ‘password’ => ‘1al2356123’])) {

Auth::login(Auth::user(), true);
print_r(Auth::user());
echo “LogIn Successffully !”.Auth::id();

echo “LogIn Successffully !”;
}

 

=======================================================================================================

Second Way:

  1. Go to config/auth.php

change driver providers

‘providers’ => [
// ‘users’ => [
// ‘driver’ => ‘eloquent’,
// ‘model’ => App\User::class,
// ],

‘users’ => [
‘driver’ => ‘database’,
‘table’ => ‘Customer’,
],
],

then it will error if error column id,password in your database column does not match with GenericUser.php.

 

2. Search GenericUser.php in project

change this function match column in your database

public function getAuthIdentifierName()
{
return ‘ID’;
}

 

public function getAuthPassword()
{
return $this->attributes[‘Password’];
}

if (Auth::attempt([‘EmailAddress’ => ‘pms@gmail.com’, ‘password’ => ‘1234’])) {
echo “LogIn Successffully !”.Auth::id();;
}

 

Note: when problem with logout function go to file DatabaseUserProvider.php remove condition related to remember_token column, or add column remember_token to your auth table

 

 

Advertisements