title: General error: 1364 Field doesn't have a default value
body: <p>I want to insert into my 'pointages' table the following data elements: matricule, datep, balance, nbrj premium work and site, but it gives me the following error:</p>
  
  <blockquote>
    <p>General error: 1364 Field 'matricule' doesn't have a default value</p>
  </blockquote>
  
  <p>Here is my code:</p>
  
  <p><strong>SalarieController</strong></p>
  
  <pre><code>public function addMultiple(Request $request){
             foreach($request-&gt;get('items') as $item){
                $pointage = Pointage::create([
               'matricule' =&gt; $item['matricule'], 
                'datep' =&gt; $item['date'],
               'solde' =&gt; $item['salaire'], 
               'nbrj' =&gt; $item['nbrj'], 
               'prime' =&gt; $item['prime'], 
               'ouvrage' =&gt; $item['ouvrage'], 
               'chantier' =&gt; $item['chantier']
               ]);
              }
                return redirect("mois");
            }
  </code></pre>
  
  <p>jQuery code </p>
  
  <pre><code>  $('.add-all').on('click', function() {
          var items = [];
          let valu = $('#datePicker').val();
         let valu1 = $('#chan option:selected').html();
         let valu2 = $('#ouv option:selected').html();
         ///
  
  
        $("tr").each(function(i,r){
          if ( i &gt; 0 &amp;&amp; $(r).find("input").first().prop("checked"))
          {  
  
           // let value = $('#nbr').val();
           let value = parseInt($(r.cells[6]).find('input').val());
            let prime = parseInt($(r.cells[7]).find('input').val());
            let sum = (((parseInt($(r.cells[5]).text()))/24) * value ) + prime;
            $(r).find("input").first().replaceWith('&lt;span style="color: green;font-weight: bolder;"&gt;✔&lt;/span&gt;');//✓ -
  
            //items.push({value,prime,sum});
           items.push({"matricule": r.cells[3].innerText,"date" : valu, "salaire": sum, "nbrj" : value , "chantier" : valu1 , "ouvrage" : valu2 , "prime": prime })
                }
               // console.log(items);
                                      });
  //ajax 
   $.ajax({ 
           method      : 'POST', 
           url       : 'mois', 
           headers: {
               'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
           },
           data      : {"items":items}, // pass in json format 
           success   : function(data) {
               console.log(data);
           },
           error : function(err){
               console.log(err)
           }
       });
  
  //fin ajax 
        });  
  </code></pre>
  
  <p><strong>mois.blade.php</strong></p>
  
  <pre><code>&lt;div id='form1'&gt;
      @if ($message = Session::get('success'))
      &lt;div class="alert alert-success"&gt;
          &lt;p&gt;{{ $message }}&lt;/p&gt;
      &lt;/div&gt;
      @endif
  
       {!! csrf_field() !!}
  
      &lt;div class="form-group"&gt;
       &lt;label&gt;Date:&lt;/label&gt;
        &lt;input type="date" id="datePicker" name="date" class="form-control" placeholder="date naissance"&gt;
      &lt;/div&gt;
  
      &lt;div class="form-group"&gt;
        &lt;label&gt;Select Chantier:&lt;/label&gt;
        {!! Form::select('chantier_id',[''=&gt;'--- Select Chantier ---']+$chantiers,null,array('class' =&gt; 'form-control','id' =&gt; 'chan')) !!}
      &lt;/div&gt;
  
      &lt;div class="form-group"&gt;
        &lt;label&gt;Select Ouvrage:&lt;/label&gt;
        {!! Form::select('ouvrage_id',[''=&gt;'--- Select Ouvrage ---'],null,array('class' =&gt; 'form-control','id' =&gt; 'ouv')) !!}
      &lt;/div&gt;
  
      &lt;div class="form-group"&gt;
        &lt;label&gt;Nbre de jour&lt;/label&gt;
          &lt;input type="text" name="nbr" id='nbr' class="form-control" placeholder="nbre de jour" value="1"&gt;
        &lt;span id='error'&gt;Input can not blank&lt;/span&gt;
      &lt;/div&gt;
  
      &lt;div class="form-group col-md-offset-5 "&gt;
        &lt;button class="btn btn-success " type="submit" id="hide"&gt;valider&lt;/button&gt;
      &lt;/div&gt;
  
    &lt;/div&gt;
  
   &lt;div id='form2'&gt;
      &lt;h3&gt;form group 2&lt;/h3&gt;
      &lt;h4&gt;DATE : &lt;span id="dateE"&gt;&lt;/span&gt;&lt;/h4&gt;
      &lt;h4&gt;chantier : &lt;span id="ch"&gt;&lt;/span&gt;&lt;/h4&gt;
      &lt;h4&gt;ouvrage : &lt;span id="ou"&gt;&lt;/span&gt;&lt;/h4&gt;
        &lt;div class="form-group col-md-offset-5 "&gt;
          &lt;button class="btn btn-success add-all" type="submit" id="hide"&gt;Pointage&lt;/button&gt;
        &lt;/div&gt;
     &lt;table class="table table-bordered" id="mytable"&gt;
          &lt;tr&gt;
              &lt;th&gt;Archive&lt;/th&gt;
              &lt;th&gt;&lt;input type="checkbox" id="check_all"&gt;&lt;/th&gt;
              &lt;th&gt;S.No.&lt;/th&gt;
              &lt;th&gt;matricule&lt;/th&gt;
              &lt;th&gt;nom &amp; prenom&lt;/th&gt;
              &lt;th&gt;salaire net&lt;/th&gt;
              &lt;th&gt;nbre de jour &lt;/th&gt;
              &lt;th&gt;prime&lt;/th&gt;
          &lt;/tr&gt;
          @if($salaries-&gt;count())
              @foreach($salaries as $key =&gt; $salarie)
                  &lt;tr id="tr_{{$salarie-&gt;id}}"&gt;
                    &lt;td&gt;archive&lt;/td&gt;
                    &lt;td&gt;&lt;input type="checkbox" class="checkbox" data-id="{{$salarie-&gt;id}}"&gt;&lt;/td&gt;
                    &lt;td&gt;{{ ++$key }}&lt;/td&gt;
                    &lt;td&gt;{{ $salarie-&gt;matricule }}&lt;/td&gt;
                    &lt;td &gt;{{ $salarie-&gt;nom }} {{ $salarie-&gt;prenom }}&lt;/td&gt;
                    &lt;td&gt;&lt;input type="hidden" name="salaire" value="{{ $salarie-&gt;salairenet }}"&gt;{{ $salarie-&gt;salairenet }}&lt;/td&gt;
                    &lt;td &gt;&lt;input type="text" class='input2' name="nbreJ" class="form-control" &gt;&lt;/td&gt;
                    &lt;td&gt;&lt;input type="text" name="prime" class="form-control" value="0"&gt;&lt;/td&gt;
                  &lt;/tr&gt;
              @endforeach
          @endif
      &lt;/table&gt;
   &lt;/div&gt;
  &lt;!--&lt;/form&gt;--&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>migration create_pointages_table.php</strong></p>
  
  <pre><code> Schema::create('pointages', function (Blueprint $table) {
              $table-&gt;increments('id'); 
              $table-&gt;string('matricule'); 
              $table-&gt;date('datep');
              $table-&gt;double('nbrj');
              $table-&gt;double('prime')-&gt;nullable();
              $table-&gt;double('solde');
              $table-&gt;string('ouvrage'); 
              $table-&gt;string('chantier'); 
  
              $table-&gt;timestamps();
          });
  </code></pre>