Support the ongoing development of Laravel.io →
Authentication Database Eloquent

Hi.. i recently changed one of my existing project to Auth. While testing i found out that all my users are not able to log in.

model/User.php

<?php
use Illuminate\Auth\UserTrait;
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableTrait;
use Illuminate\Auth\Reminders\RemindableInterface;

class User extends Eloquent implements UserInterface, RemindableInterface {

    use UserTrait, RemindableTrait;
    
    use SoftDeletingTrait;


    protected $dates = ['deleted_at'];


    protected $hidden = array('password');


    protected $table    = 'users';
   
    public function role()
    {
        return $this->belongsTo('Role');
    }  
      
}

login function

$input = array(			
			'email' 		=> Input::get( 'email' ), 		// login using email
			'password'      => Input::get( 'password' ),
        );

    	if(Auth::attempt($input)) 

tried this and both statement return true

// hashed password saved in the DB
$hash = '$2y$08$n6Yt9eeTK33kvfOf/KDkt.CZTCVJkvZo3etbJZsqgN0HVAhhD9LXK';
var_dump(password_verify('123456', $hash));
var_dump(password_verify('123456', Hash::make('123456')));

i have check my users table and the password is Varchar 255

Last updated 3 years ago.
0

Same issue here.

0

think i fixed the error but adding the following to model/User.php

 /**
     * Get the unique identifier for the user.
     *
     * @return mixed
     */
    public function getAuthIdentifier()
    {
        return $this->getKey();
    }

    /**
     * Get the password for the user.
     *
     * @return string
     */
    public function getAuthPassword()
    {
        return $this->password;
    }
0

Sign in to participate in this thread!

Eventy

Your banner here too?

bczm8703 bczm8703 Joined 22 Jul 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.