samedi 1 avril 2017

Laravel 5 Migration Error Column not found: 1054 Unknown column 'name_with_initials' in 'field list'

I`m developing a large form for a web site.after setting everything i tried to enter inputs and it getting error like this enter image description here

Here is the model userregistration

   class userregistration extends Model
{

    protected $table = "userregistration";
   protected $fillable = ['id','full_name','name_with_initials','nic_no','date_of_birth','age','sex','marital_status','Permanent_address','temporary_address','home_tel','mobile_tel','gce_ol_year','gce_ol_results','gce_al_year','gce_al_results','institute','qualification','batch','organization','completed_training','trainee_year','person_name','person_address','contact_number','relationship','start_date','end_date','training_type','bank_name','branch_name','account_no'];
}

Here is the controller store function

 public function store(Request $request)
{
    $item = new userregistration;
     // $item ->id = Auth::user() ->id;
    $item ->full_name = $request ->full_name; 
    $item ->name_with_initials = $request ->name_with_initials;
    $item ->nic_no = $request ->nic_no;
    $item ->date_of_birth = $request ->date_of_birth;
    $item ->age = $request ->age; 
    $item ->sex = $request ->sex;
    $item ->marital_status = $request ->marital_status;
    $item ->Permanent_address = $request ->Permanent_address;
    $item ->temporary_address = $request ->temporary_address; 
    $item ->home_tel = $request ->home_tel;
    $item ->mobile_tel = $request ->mobile_tel;
    $item ->gce_ol_year = $request ->gce_ol_year;
    $item ->gce_ol_results = $request ->gce_ol_results; 
    $item ->gce_al_year = $request ->gce_al_year;
    $item ->gce_al_results = $request ->gce_al_results;
    $item ->institute = $request ->institute;
    $item ->qualification = $request ->qualification; 
    $item ->batch = $request ->batch;
    $item ->organization = $request ->organization;
    $item ->completed_training = $request ->completed_training;
    $item ->trainee_year = $request ->trainee_year; 
    $item ->person_name = $request ->person_name;
    $item ->person_address = $request ->person_address;
    $item ->contact_number = $request ->contact_number;
    $item ->relationship = $request ->relationship; 
    $item ->start_date = $request ->start_date;
    $item ->end_date = $request ->end_date;
    $item ->training_type = $request ->training_type;
    $item ->bank_name = $request ->bank_name; 
    $item ->branch_name = $request ->branch_name;
    $item ->account_no = $request ->account_no;


    $item ->save();

         userregistration::create($request->all());
            return redirect()->route('/registration')
                    ->with('success','Item created successfully');   


 }

Here is the form i created

    <div class="form-group">

        <label>Full Name</label>
        <input type="hidden" value="" name="_token" />
        <input type="text" name="full_name" class="form-control" value="">
        </div>

        <div class="form-group">

        <label>Name with initials</label>
        <input type="text" name="name_with_initials"class="form-control" value="">
        </div>

        <div class="form-group">

        <label>National ID Number</label>
        <input type="text" name="nic_no"class="form-control" value="">
        </div>

        <div class="form-group">
        <label>Date Of Birth</label>
        <input class="form-control" name="date_of_birth" type="date" value="2011-08-19" id="example-date-input">
        </div>

        <div class="form-group">
         <label>Age</label>
        <input type="text" name="age"class="form-control" value="">
        </div>

        <div class="form-group">
         <label>Sex</label>
       <label class="radio-inline"><input type="radio" name="sex" value="male">Male</label>
        <label class="radio-inline"><input type="radio" name="sex" value="female">Female</label>
        </div>

    <div class="form-group">
    <label>marital Status</label>
        <label class="radio-inline"><input type="radio" name="marital_status" value="single">Single</label>
        <label class="radio-inline"><input type="radio" name="marital_status" value="married">Married</label>
        </div>

         <div class="form-group">
        <label>Permanent Address</label>
        <input type="text" name="Permanent_address"class="form-control" value="">
        </div>

         <div class="form-group">
        <label>Temporary Address</label>
        <input type="text" name="temporary_address"class="form-control" value="">
        </div>

         <div class="form-group">
        <label>Home Tel:</label>
        <input type="text" name="home_tel"class="form-control" value="">
        </div>

         <div class="form-group">
        <label>Mobile Tel:</label>
        <input type="text" name="mobile_tel"class="form-control" value="">
        </div>

        <label>EDUCATIONAL QUALIFICATIONS</label>

        &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;  &nbsp;

  <div class="form-group">
        <label>GCE(O/L) Year:</label>
    <input class="form-control" name="gce_ol_year" type="month" value="2011-08" id="example-month-input">
  </div>

   <div class="form-group">
        <label>GCE(O/L) Results</label>
        <input type="text" name="gce_ol_results"class="form-control" value="">
        </div>


  <div class="form-group">
        <label>GCE(A/L) Year:</label>
    <input class="form-control" name="gce_al_year" type="month" value="2011-08" id="example-month-input">
  </div>

   <div class="form-group">
        <label>GCE(A/L) Results</label>
        <input type="text" name="gce_al_results" class="form-control" value="">
        </div>


<label>PROFESSIONAL QUALIFICATION</label>

<div class="form-group">
        <label>Institute</label>
        <input type="text" name="institute" class="form-control" value="">
        </div>

         <div class="form-group">
         <label>Qualification on</label>
       <label class="radio-inline"><input type="radio" name="qualification" value="bsc">BSc</label>
        <label class="radio-inline"><input type="radio" name="qualification" value="beng">BEng</label>
         <label class="radio-inline"><input type="radio" name="qualification" value="diploma">Diploma</label>
          <label class="radio-inline"><input type="radio" name="qualification" value="certificate">Certificate</label>
        </div>

        <div class="form-group">
        <label>Batch</label>
        <input type="text" name="batch" class="form-control" value="">
        </div>


<label>TRAINEE HISTORY</label>

<div class="form-group">
        <label>Organization</label>
        <input type="text" name="organization"class="form-control" value="">
        </div>

        <div class="form-group">
        <label>Completed Training</label>
        <input type="text" name="completed_training"class="form-control" value="">
        </div>

         <div class="form-group">
        <label>Year:</label>
    <input class="form-control" name="trainee_year" type="month" value="2011-08" id="example-month-input">
  </div>

  <label>PERSON TO CONTACT IN CASE OF EMERGENCY</label>

<div class="form-group">
        <label>Name</label>
        <input type="text" name="person_name"class="form-control" value="">
        </div>

        <div class="form-group">
        <label>Address</label>
        <input type="text" name="person_address"class="form-control" value="">
        </div>

        <div class="form-group">
        <label>Contact Number</label>
        <input type="text" name="contact_number"class="form-control" value="">
        </div>

        <div class="form-group">
        <label>Relationship to you</label>
        <input type="text" name="relationship"class="form-control" value="">
        </div>

<label>TRAINING PERIOD</label>

<div class="form-group">
        <label>Starting Date:</label>
    <input class="form-control" name="start_date" type="date" value="2011-08-19" id="example-date-input">
  </div>

  <div class="form-group">
        <label>End Date:</label>
    <input class="form-control" name="end_date" type="date" value="2011-08-19" id="example-date-input">
  </div>

  <div class="form-group">
    <label>Training Type</label>
        <label class="radio-inline"><input type="radio" name="training_type" value="general training">General Training</label>
        <label class="radio-inline"><input type="radio" name="training_type" value="on job training" >On Job Training</label>
        </div>

        <label>Bank Details</label>

<div class="form-group">
<label>Bank Name</label>
        <input type="text" name="bank_name" class="form-control" value="">
        </div>

<div class="form-group">
<label>Branch Name</label>
        <input type="text" name="branch_name" class="form-control" value="">
        </div>
<div class="form-group">
<label>Account No</label>
        <input type="text" name="account_no" class="form-control" value="">
        </div>



         <input type="submit" class="btn btn-success pull-right">


      </form>

            </div>

Can anyone help me to get solve this? Thank you.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire