Support the ongoing development of Laravel.io →
Authentication Forms Input

I keep getting all sorts of funny errors just by trying to see an application can actually work in Laravel and that it's not a myth. First, I had to wrestle with all the suggestion on this issue. Painfully, the answer that helped me was the penultimate on such a long long thread of framework contributors living in denial. I've encountered dozens more, scoured tutorial sites, read this official doc on Laravel auth and stackoverflow questions with outdated answers to the cryptic errors I've been riddled with.

Some of the errors would have been avoidable if my auth table name was simply "users" and even now I've changed to "users", I'm still stuck.

I eventually logged in at some point by removing this line

$this->middleware('auth');

from the HomeController constructor then manually setting up my own auth like I would have done in 30mins if I was developing from scratch. But it felt contrived. The tutorials say everything should work out of the box without touching any native PHP functions so I uncommented the line and continued writhing.

The present situation is that the login form just lies there even though I've manually seeded my database. From the web.php file (which I understand is neo routes.php), I have

Route::post('/login', 'HomeController@loginPost');

Then in its controller, the latest snippet I've tried is this

public function loginPost() {
        var_dump(Input::all());
        if (Auth::attempt(Input::all())) {
            var_dump('expression');
        User::create([
        'username' => strtolower(Input::get('username')),
        'password' => Hash::make(Input::get('password')),
        ]);

$user = User::where('username', '=', strtolower(Input::get('username')));

Auth::login($user);
        }
        else var_dump('expression2');
    }

It's probably supposed to be email there instead of username but I did a replace all in the view, swapping email for username since the application's authentication ID should be their usernames and not their emails. When I hit enter now, the page just reloads with empty input fields. It's even tired of throwing errors at me. Is there a way out or is Laravel just not for me?

Last updated 3 years ago.
0

You can try applying the manual authentication. Access Laravel's authentication services via the Auth facade, I hope it will solve your issue.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

nmeri17 nmeri17 Joined 23 May 2017

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.