title: Laravel Form Validation on POST request
body: <p>I have a form which is divided into 2 parts.
  The first part of the form is displayed with "GET" request when the user clicks a button. when the user fills this form and clicks next, the page is redirected to the next part of the form with a "POST" request which first saves the form and then displays the next part. 
  The problem is when i try to validate the 2nd part of the form, laravel gives and error saying method not allowed.</p>
  
  <p>my first controller:</p>
  
  <pre><code>public function create(Request $request)
  {
  
      $validator = Validator::make($request-&gt;all(), [
          'unit_code' =&gt; 'max:25',
          'unit_title' =&gt; 'max:255',
          'project_title' =&gt; 'max:255',
          'project_ref_number' =&gt; 'max:255',
          'storage_location' =&gt; 'required|max:255',
          'keeper_name' =&gt; 'required|max:255',
      ]);
  
      if ($validator-&gt;fails()) {
          return redirect()-&gt;back()
                      -&gt;withErrors($validator)
                      -&gt;withInput();
      }
  
      $notification = Notification::create([
          'unit_code'         =&gt;$request-&gt;unit_code,
          'unit_title'        =&gt;$request-&gt;unit_title,
          'project_title'     =&gt;$request-&gt;project_title,
          'project_ref_number'=&gt;$request-&gt;project_ref_number,
          'storage_location'  =&gt;$request-&gt;storage_location,
          'keeper_name'       =&gt;$request-&gt;keeper_name,
          'user_id'           =&gt;Auth::user()-&gt;id
          ]);
  
      return view('Notification.notification_for_lmo')-&gt;with('notification', $notification);
      //return redirect()-&gt;route('show.material_List')-&gt;with('notification'); 
  
  }
  </code></pre>
  
  <p>routes:</p>
  
  <pre><code>/*route to personal information form for notification*/
      Route::get('/personal_information_notification_form', 'HomeController@getNotificationForm');
  
      /*submit personal information and go to next part of the form*/
      Route::post('personal_information_notification_form/submit/', 'NotificationController@create')-&gt;name('submit.personal_info_for_notification');
  
      /*route to material list form for notification application*/
      Route::get('personal_information_notification_form/material_list/', 'NotificationController@showMaterialListForm')-&gt;name('show.material_List');
  
      /*submit the material list*/
      Route::post('/personal_information_notification_form/add_lmo/', 'NotificationTypeAController@create')-&gt;name('submit.add_lmo');
  </code></pre>
  
  <p>2nd controller:</p>
  
  <pre><code>public function create(Request $request)
  {
      /*this loop is because im adding rows dynamically to the table*/
      $count = count($request-&gt;input('item_name'));
  
      for ($i=0; $i&lt;$count; $i++){
  
          $validator = Validator::make($request-&gt;all(), [
              'material_type' =&gt; 'required|max:25',
              'item_name' =&gt; 'required|max:255',
              'risk_level' =&gt; 'required|max:255',
              'quantity' =&gt; 'required|max:255',
              'volume' =&gt; 'required|max:255',
              'notification_id' =&gt; 'required|max:255',
          ]);
  
      }
  
      if ($validator-&gt;fails()) {
          return view('Notification.notification_for_lmo')-&gt;withErrors($validator)-&gt;withInput();
      }
  
      for ($i=0; $i&lt;$count; $i++){
  
          $data  = NotificationTypeA::create([
              'material_type'  =&gt;$request-&gt;material_type[$i],
              'item_name'      =&gt;$request-&gt;item_name[$i],
              'risk_level'     =&gt;$request-&gt;risk_level[$i],
              'quantity'       =&gt;$request-&gt;quantity[$i],
              'volume'         =&gt;$request-&gt;volume[$i],
              'notification_id'=&gt;$request-&gt;notification_id
          ]);
      }
  
  
  
          $admin = Admin::find(1);
          $user = Auth::user();
          $notification = Notification::find($request-&gt;notification_id);
          $admin-&gt;notify(new NewNotificationApplicationSubmitted($user-&gt;name, $notification-&gt;id));
  
          return redirect()-&gt;route('show.go_to_notification')-&gt;with('message', 'We have notified '.$user-&gt;name.' that he/she is added to SSBC')-&gt;with('status', 'info');
  
      }
  </code></pre>
  
  <p>In the second controller, there is a for loop because the user fills the data in a table form. (the blade file is big so i am not posting it here.)</p>
  
  <p>What is the problem with this and why is this happening?</p>
  
  <p>first blade:</p>
  
  <pre><code>&lt;div class="well"&gt;
                      &lt;form class="form-horizontal" role="form" method="POST" action="{{route('submit.personal_info_for_notification')}}"&gt;
                          {{ csrf_field() }}
  
                          &lt;fieldset&gt;
                              &lt;legend&gt;
                                  SECTION 1 - Personal Details
                              &lt;/legend&gt;
                              &lt;div class="row"&gt;
                                  &lt;div class="col-xs-12"&gt;
  
                                      &lt;div class="form-group"&gt;
                                          &lt;div class="col-xs-12"&gt;
                                              {!! Form::label('unit_code', 'Unit Code (if teaching):', ['class' =&gt; 'control-label']) !!} &lt;br&gt;
                                              {!! Form::text('unit_code', $value = null, ['class' =&gt; 'form-control']) !!}
                                          &lt;/div&gt;
                                          &lt;div class="col-xs-12"&gt;
                                              {!! Form::label('unit_title', 'Unit Title (if teaching):', ['class' =&gt; 'control-label']) !!} &lt;br&gt;
                                              {!! Form::text('unit_title', $value = null, ['class' =&gt; 'form-control']) !!}
                                          &lt;/div&gt;
                                          &lt;div class="col-xs-12"&gt;
                                              {!! Form::label('project_title', 'Project Title (if FYP/research):', ['class' =&gt; 'control-label']) !!} &lt;br&gt;
                                              {!! Form::text('project_title', $value = null, ['class' =&gt; 'form-control']) !!}
                                          &lt;/div&gt;
                                          &lt;div class="col-xs-12"&gt;
                                              {!! Form::label('project_ref_number', 'Ref. No (if FYP/research):', ['class' =&gt; 'control-label']) !!} &lt;br&gt;
                                              {!! Form::text('project_ref_number', $value = null, ['class' =&gt; 'form-control']) !!}
                                          &lt;/div&gt;
                                          &lt;div class="col-xs-12"&gt;
                                              {!! Form::label('storage_location', 'Storage Location:', ['class' =&gt; 'control-label']) !!} &lt;br&gt;
                                              {!! Form::text('storage_location', $value = null, ['class' =&gt; 'form-control' ]) !!}
                                          &lt;/div&gt;
                                          &lt;div class="col-xs-12"&gt;
                                              {!! Form::label('keeper_name', 'Name of the Keeper:', ['class' =&gt; 'control-label']) !!} &lt;br&gt;
                                              {!! Form::text('keeper_name', $value = null, ['class' =&gt; 'form-control' ]) !!}
                                          &lt;/div&gt;
                                      &lt;/div&gt;
  
                                  &lt;/div&gt;
                              &lt;/div&gt;
                          &lt;/fieldset&gt;
                          &lt;div class="row"&gt;
                              &lt;div class="form-group"&gt;
                                  &lt;div class="col-md-12"&gt;
                                      &lt;button type="submit" class="btn btn-primary btn-block"&gt;Next&lt;/button&gt;
                                  &lt;/div&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/form&gt;
                  &lt;/div&gt;
  </code></pre>
  
  <p>2nd blade:</p>
  
  <pre><code>&lt;form class="form-horizontal" role="form" method="POST" action="{{ route('submit.add_lmo') }}"&gt;
                          {{ csrf_field() }}
  
                          &lt;fieldset&gt;
                              &lt;div class="row"&gt;
                                  &lt;div class="col-xs-12"&gt;
                                      &lt;div class="row"&gt;
                                          &lt;legend&gt;
                                              SECTION 2 – Details of the Biohazardous Materials
                                          &lt;/legend&gt;
                                          &lt;div class="col-xs-8"&gt;
                                              &lt;h4&gt;List of Living Modified Organism (LMO)&lt;/h4&gt;
                                          &lt;/div&gt;
                                          &lt;div class="col-xs-4"&gt;
                                              &lt;input type="checkbox"/&gt;Applicable
                                          &lt;/div&gt;
                                      &lt;/div&gt;
                                      &lt;div class="row"&gt;
                                          &lt;div class="col-xs-12"&gt;
                                              &lt;div id="LMOtablediv"&gt;
                                                  &lt;input type="button" id="addmoreLMObutton" value="Add" onclick="insRow(event)" /&gt;
                                                  &lt;table id="addLMOtable" border="1"&gt;
                                                      &lt;thead&gt;
                                                          &lt;tr&gt;
                                                              &lt;td&gt;No.&lt;/td&gt;
                                                              &lt;td&gt;Notification ID&lt;/td&gt;
                                                              &lt;td&gt;Material Type&lt;/td&gt;
                                                              &lt;td&gt;Name&lt;/td&gt;
                                                              &lt;td&gt;Risk Level&lt;/td&gt;
                                                              &lt;td&gt;Quantity&lt;/td&gt;
                                                              &lt;td&gt;Volume&lt;/td&gt;
  
                                                          &lt;/tr&gt;
                                                      &lt;/thead&gt;
                                                      &lt;tbody&gt;
                                                          &lt;tr&gt;
                                                              &lt;td&gt;1&lt;/td&gt;
                                                              &lt;td&gt;&lt;input type="text" name="notification_id" id="notification_id" value="{{$notification-&gt;id}}"&gt;&lt;/td&gt;
                                                              &lt;td&gt;{!! Form::text('material_type[]', null, array('id'=&gt;'material_type'))!!}&lt;/td&gt;
                                                              &lt;td&gt;{!! Form::text('item_name[]', null, array('id'=&gt;'item_name'))!!}&lt;/td&gt;
                                                              &lt;td&gt;{!! Form::text('risk_level[]', null, array('id'=&gt;'risk_level'))!!}&lt;/td&gt;
                                                              &lt;td&gt;{!! Form::number('quantity[]', null, array('id'=&gt;'quantity'))!!}&lt;/td&gt;
                                                              &lt;td&gt;{!! Form::number('volume[]', null, array('id'=&gt;'volume'))!!}&lt;/td&gt;
  
                                                              &lt;td&gt;&lt;input type="button" id="delLMObutton" value="Delete" onclick="deleteRow(this)"/&gt;&lt;/td&gt;
                                                          &lt;/tr&gt;
                                                      &lt;/tbody&gt;
                                                  &lt;/table&gt;
                                              &lt;/div&gt;
                                          &lt;/div&gt;
                                      &lt;/div&gt;
                                  &lt;/div&gt;
                              &lt;/div&gt;
                          &lt;/fieldset&gt;
  
                          &lt;div class="row"&gt;
                              &lt;div class="form-group"&gt;
                                  &lt;div class="col-md-6 col-md-offset-10"&gt;
                                      &lt;button type="submit" class="btn btn-primary"&gt;Submit&lt;/button&gt;
                                  &lt;/div&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/form&gt;
  </code></pre>