Laravel5 itself with login verification, such as open localhost/home will automatically jump to localhost/auth/login if I want to post a request in the client to localhost/auth/login how should I send it? Does the body of the post need to write a lot of things, including Email,password,_token? In addition, the login succeeds or fails to return a custom string prompt succeeds or fails, and now comes with redirect. Novice seeking Guidance
Reply content:
Laravel5 itself with login verification, such as open localhost/home will automatically jump to localhost/auth/login if I want to post a request in the client to localhost/auth/login how should I send it? Does the body of the post need to write a lot of things, including Email,password,_token? In addition, the login succeeds or fails to return a custom string prompt succeeds or fails, and now comes with redirect. Novice seeking Guidance
You can redefine the Postlogin method in HomeController
Laravel5 default Postlogin is just the most basic example, if you can use, it is best, basically can only be used as a reference, formal development must have a lot of exceptions
The default Postlogin method is
Authenticatesandregistersusers in this trait
including login, registration, logout, etc.
Laravel implementation of the form is _token (Csrf_token) + _method (post|put|patch|head|get|) + body
Laravel all view can directly access a $errors (instance) can be determined by $error->has () that there is no error $errors->all () Extract all error content error Implementation mechanism is flash session so whether it is Return redirect or return view can be accessed to the $erorrs
Suggest studying https://laracasts.com/series/laravel-5-fundamentals and you'll be transparent.
@if (count($errors) > 0)
@foreach ($errors->all() as $error)
- {{ $error }}
@endforeach
@endif
You can copy this into the template and watch it.