Wednesday, May 9, 2018

Laravel login not working - development

Laravel login not working

I am creating the login controller myself going off the docs on laravel and my login controller doesn’t seem to be working. Here is my code:

<?php

namespace AppHttpControllers;

use IlluminateHttpRequest;
use IlluminateSupportFacadesAuth;
use AppUser;

class UserController extends Controller
{
    public function __construct()
    {
        $this->middleware('guest')->except('logout');
    }

    public function index()
    {

    }

    public function auth()
    {
        if(request('login')) {
            if(request('rem')) {
                if (Auth::attempt(['username' => request('username'), 'password' => request('password')], $remember)) {
                    echo "true";
                } else {
                    return redirect('/login');
                }
            } else {

            }
        } elseif(request('forgot')) {

        } else {
            return redirect('/login');
        }
    }

    public function logout()
    {
        Auth::logout();
    }
}

What exactly am i doing wrong. I just started laravel like 2 weeks ago and i finally get to where i can make an authentication and it is nothing but issues for me. I am trying not to give up on this framework and i don’t want to use make:auth because i want to use username not email and use my own template. Make:Auth would take the fun of coding away as well.



from Laravel Questions and Answers https://laravelquestions.com/laravel/laravel-login-not-working/
via Lzo Media

No comments:

Post a Comment