Are you using blade or regular html? If regular html you need this in your form:
<input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
If you are using blade it should work, double check your variable names etc.
Also see: http://laravel.io/forum/11-14-2014-laravel-5-cant-post
I believe the issue is actually in the controller as the form is validated and the postRegister
method is called but that $user
variable is not defined anywhere
Could you post here your form you're submitting?
Here's my view: (I modified the new default blade escaping syntax)
{{ Form::open() }}
<!--Email Form Input-->
<div class="form-group">
{{ Form::label('email', 'Email:') }}
{{ Form::email('email', null, ['class' => 'form-control']) }}
</div>
<!--Password Form Input-->
<div class="form-group">
{{ Form::label('password', 'Password:') }}
{{ Form::password('password', ['class' => 'form-control']) }}
</div>
<!--Password Confirmation Form Input-->
<div class="form-group">
{{ Form::label('password_confirmation', 'Confirm Password:') }}
{{ Form::password('password_confirmation', ['class' => 'form-control']) }}
</div>
<!--Register Form Input-->
<div class="form-group">
{{ Form::submit('Register', ['class' => 'btn btn-primary']) }}
</div>
{{ Form::close() }}
Are you sure you are in laravel 5? Because l5 is needing this format in forms:
{!! Form::open(array('url' => 'loggin')) !!}
The {!! !!} to work. Or did you somehow get the
{{ }}
format working.
I get same error, I am now also working on this.
Yes, I reverted to the old syntax with:
Blade::setEchoFormat('%s');
I'm new to laravel to:
You need this:
public function postRegister(RegisterRequest $request)
{
// Registration form is valid, create user...
$user = \App\User::create($request->all()); // add this line
$this->auth->login($user);
return redirect('/'); // or to where ever
}
Record has to be added to database. But first go to your model and setup a setter to hash the password.
See https://laracasts.com/series/whats-new-in-laravel-5/episodes/5
I ended up doing this, I use userid, you use email, so yours will be email:
public function postRegister(RegisterRequest $request)
{
// Registration form is valid, create user...
//$user = \App\User::create($request->all());
$user = new \App\User();
$user->userid = $request->input('userid');
$user->password = \Illuminate\Support\Facades\Hash::make($request->input('password'));
$user->save();
$this->auth->login($user);
return redirect('pets'); //or where ever here
}
This worked
Thanks, I watched the Laracasts video but when implementing forgot all about manually creating the user. It's working now :)
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community