Login and registration form in Laravel 5 -
Login and registration form in Laravel 5 -
i start larn new laravel , trying larn it, building little project, create starter site, have problem. create new project without plugin. have problem login , register form. set route file:
get('user/login', 'auth\authcontroller@showloginform'); post('user/login', 'auth\authcontroller@postlogin'); get('user/register', 'auth\authcontroller@showregistrationform'); post('user/register', 'auth\authcontroller@register');
and create login , register form. shows me forms, can't submit , not know how insert database or how validate user credentials. can tell me how in new beta laravel framework?
problem laravel shows me login , register form. when click submit didn't nothing, refresh page. set method="post" action="" forms. when alter
public function register(registerrequest $request)
into
public function register()
in app\http\controllers\auth\authcontroller, when submit form give me error $request not find.
you can see code in: this link
this how works in laravel 5 when utilize request. if inject request object illustration way:
public function register(registerrequest $request) { // code goes here }
the code of function won't executed until registerrequest
validate info success.
looking @ rules:
homecoming [ 'email' => 'required|email|unique:users', 'password' => 'required|confirmed|min:8', ];
you need create sure info pass rules.
you should add together form displaying errors:
@foreach ($errors->all() $error) {{ $error }} @endforeach
to display validation errors in form.
edit
everything seems fine in code. valid function beingness launched. if don't believe me, alter register
function into:
public function register() { homecoming "this register function"; }
the error because if remove registerrequest $request
function parameter, cannot later utilize $request->email;
because it's undefined
laravel laravel-routing laravel-5 laravel-form laravel-request
Comments
Post a Comment