How to save post form in Laravel-4

user3825129

I am creating parent email form in this form parent insert his email id. I facing problem is when I submit form that showing error ,Method [save] does not exist and my code is

registration form

<div class="form">
    {{ Form::open(array('url' => '/api/v1/parents/registration_step_2', 'class' => "worldoo-form form form-horizontal", 'id' => "signupForm", 'method' => "post" )) }}
      <div class="form-group ">
        {{ Form::label('cemail', 'Please enter your parents e-mail:', array('class' => "control-label"));}}
        <div class="">
          {{ Form::email('cemail', '', array('class' => "form-control", 'id' => "cemail"));}}
          <i class="sprite success form-control-feedback"></i> </div>
        <h5 class="regular-font text-left">Your parents will need to activate your account before you can access worldoo.</h5>
      </div>
      <div class="form-group">
        <div class="text-center">
          {{Form::submit('Next', array('class' => "btn btn-primary"));}}
        </div>
      </div>
    {{ Form::close() }}
</div>

my controller

public function registrationStepTwo()
{

    $cemail = $_REQUEST['cemail'];

    if($cemail != '')
    {
        $parent = new Parent;
        $parent->email = $cemail;
        $parent->save();
    }

}
Lakitha Samarasinghe

I had the save issues, with the exact same class name "Parent" at it also throws

Method [save] does not exist

The reason you can save the $parent model data is because of the name that you have given to the model as

Parent

Change the model name to something else and it will work as expected. Looks like the class Parent must be laravel's system class and we cannot give that name to our custom classes.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to post Json in form to controller then save to database

How to save users post in the database in laravel?

Laravel 5.2: How to save multiple form fields?

How to make form submit with post in laravel 5.4

Save form data in laravel

Django how to save value to model without being present on form post

How do I access POST data in overriden form save method?

Laravel4: How to pass Datepicker into a form?

Laravel MethodNotAllowedHttpException on POST form

Laravel form post - MethodNotAllowedHttpException

Laravel post form is not submitting?

How to save array from XMLHTTPREQUEST API POST to Laravel Controller

How to save data into mysql database from laravel route post

How to save multiple form data using jquery ajax in laravel?

How to save multiple form field into database using laravel 5.4

How to serialize form in ajax and save data in database with laravel?

Laravel 4 - save tags

Rails 4 -Simple Form how to save key and display value

Laravel save multiple form to database

How to pass js array with post request on form submit to controller in Laravel?

How to add form data on Post requests for Buzz HTTP Client on Laravel?

How do I post a form in laravel 5 using ajax?

How do I post data from a form into a database with laravel?

How to post laravel form data to controller using ajax in API

How to post form using ajax in popup without reload page in laravel

How to create an json array in angular 4 for post my form

post form action to controller in laravel

Post a form using ajax in Laravel

Submitting POST form laravel error