Laravel Auth::attempt() fails

Published

When I register a new user and I want to sign him in by using auth attempt it doesn’t work while the user is saved to database

static function register()
{
    if(self::$validate['message'])
    {
        $user = User::create([
            'name' => self::$values['name'],
            'email' => self::$values['email'],
            'password' => Hash::make(self::$values['password'])
        ]);

        Auth::attempt($user,true);
        Auth::attempt($user->only(['email','password']));

        return result::repsonse(true);
    } else 
        return self::$validate;
}

Source: Laravel

Published
Categorised as laravel Tagged

Answers

Leave a Reply

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq