Answers for "laravel login redirect to back"

PHP
4

laravel redirect back

return Redirect::back()->withErrors(['msg', 'The Message']);

and inside your view call this

@if($errors->any())
<h4>{{$errors->first()}}</h4>
@endif
Posted by: Guest on August-20-2020
0

redirect after login laravel

class RegisterController extends Controller
{
    protected $redirectTo = '/home';

    protected function redirectTo()
    {
        if (auth()->user()->role_id == 1) {
            return '/admin';
        }
        return '/home';
    }

}
Posted by: Guest on July-30-2020

Browse Popular Code Answers by Language