I have a website that consists of 2 different login forms in 2 places, one on the navigation bar and the other is the login page that will be used when the system catches an unregistered visitor.
May I ask what I did wrong in my LoginRequest.php, where I set the condition for redirecting to the user login page, if there is any error during the registration process? I have my codes as shown below:
<?php namespace App\Http\Requests; use App\Http\Requests\Request; class LoginRequest extends Request { public function authorize() { return true; } public function rules() { return [ 'login_email' => 'required', 'login_password' => 'required' ]; } public function messages() { return [ 'login_email.required' => 'Email cannot be blank', 'login_password.required' => 'Password cannot be blank' ]; } public function redirect() { return redirect()->route('login'); } }
The code is supposed to redirect users who enter from the navigation panel if there is any error on the login page, but it is not redirected.
Thanks.
php laravel laravel-5 laravel-routing laravel-validation
Kenny yap
source share