Laravel 5.1: When a user is authenticated via regular POST
request, an array of all validation errors can be accessed via method $errors->all()
. However when a user is authenticated via Ajax request, the property all
is not available in the returned object. How can I make Validator
to return error messages with $errors->all()
or in the same structure when authenticating via Ajax request?
public function postLogin(Request $request)
{
$this->validate($request, [
$this->loginUsername() => 'required', 'password' => 'required',
]);
$credentials = $this->getCredentials($request);
if (Auth::attempt($credentials, $request->has('remember'))) {
return $this->handleUserWasAuthenticated($request, $throttles);
}
}
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1loif0X
via IFTTT
Aucun commentaire:
Enregistrer un commentaire