lundi 25 janvier 2016

Auth::check() worked in controller but not working in view?

I used Auth::attempt() to log user:

if (Auth::attempt(['email' => $email, 'password' => $password], true)) {
        return redirect('/');
    }
    else{
        return 'wrong email or pass';
    }

Then I reload browser and call function:

if (Auth::check()) {
        return 1;
    }

And this return 1;

But when I call:

@if (\Illuminate\Support\Facades\Auth::check())
            echo '<label style="width: 20%;color: #ff3f41;margin-left: 10px;">login</label>';
        @else
            echo '<label style="width: 20%;color: #ff3f41;margin-left: 10px;">nothing</label>';

        @endif

This print nothing.

Any helps. Thanks.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1lMLYQQ
via IFTTT

Aucun commentaire:

Enregistrer un commentaire