title: Laravel 8 use same form for edit and create ,
body: <p>I am new to Laravel and I am trying to use the same form fields for Update and create,
  using @include I load same form to create and update views,can someone explain why this is,,and what I am missing is,</p>
  <p>feilds.blade.php</p>
  <pre><code>
  
  &lt;div class=&quot;form-group pad-top40&quot;&gt;
      &lt;div class=&quot;row&quot;&gt;
          &lt;label for=&quot;inputUsername&quot; class=&quot;col-sm-4 control-label&quot;&gt;
              Warehouse Number
          &lt;/label&gt;
          &lt;label for=&quot;inputUsername&quot; class=&quot;col-sm-4 control-label&quot;&gt;
              Number
          &lt;/label&gt;
          &lt;label for=&quot;inputUsername&quot; class=&quot;col-sm-4 control-label&quot;&gt;
              Warehouse Code
          &lt;/label&gt;
      &lt;/div&gt;
      
          &lt;div class=&quot;col-sm-4&quot;&gt;
              &lt;div class=&quot;input-group&quot;&gt;
                      &lt;span class=&quot;input-group-append&quot;&gt;
                          &lt;span class=&quot;input-group-text&quot;&gt;&lt;i
                                      class=&quot;livicon&quot; data-name=&quot;number&quot;
                                      data-size=&quot;18&quot; data-c=&quot;#000&quot;
                                      data-hc=&quot;#000&quot; data-loop=&quot;true&quot;&gt;&lt;/i&gt;&lt;/span&gt;
                      &lt;/span&gt;
                  &lt;input type=&quot;number&quot; class=&quot;form-control&quot;
                  placeholder=&quot;No&quot; id=&quot;no&quot; name=&quot;no&quot;&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class=&quot;col-sm-4&quot;&gt;
              &lt;div class=&quot;input-group&quot;&gt;
                      &lt;span class=&quot;input-group-append&quot;&gt;
                          &lt;span class=&quot;input-group-text&quot;&gt;&lt;i
                                      class=&quot;livicon&quot; data-name=&quot;number&quot;
                                      data-size=&quot;18&quot; data-c=&quot;#000&quot;
                                      data-hc=&quot;#000&quot; data-loop=&quot;true&quot;&gt;&lt;/i&gt;&lt;/span&gt;
                      &lt;/span&gt;
                  &lt;input type=&quot;text&quot; class=&quot;form-control&quot;
                         placeholder=&quot;Warehouse Code&quot; id=&quot;wh_code&quot; name=&quot;wh_code&quot; value='{{old('wh_code','')}}'&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
         &lt;br&gt;
         &lt;br&gt;
  
      &lt;div class=&quot;row&quot;&gt;
          &lt;label for=&quot;address1&quot; class=&quot;col-sm-8 control-label&quot;&gt;
              Address Line 1
          &lt;/label&gt;
          &lt;label for=&quot;inputexpdate&quot; class=&quot;col-sm-4 control-label&quot;&gt;
              Register Date
          &lt;/label&gt;
          
      &lt;/div&gt;
      &lt;div class=&quot;row&quot;&gt;
          &lt;div class=&quot;col-sm-8&quot;&gt;
              &lt;div class=&quot;input-group&quot;&gt;
                      &lt;span class=&quot;input-group-append&quot;&gt;
                          &lt;span class=&quot;input-group-text&quot;&gt;&lt;i
                                      class=&quot;livicon&quot; data-name=&quot;address&quot;
                                      data-size=&quot;18&quot; data-c=&quot;#000&quot;
                                      data-hc=&quot;#000&quot; data-loop=&quot;true&quot;&gt;&lt;/i&gt;&lt;/span&gt;
                      &lt;/span&gt;
                  &lt;input type=&quot;text&quot; class=&quot;form-control&quot; placeholder=&quot;Address&quot; id=&quot;address1&quot; name=&quot;address1&quot;&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;div class=&quot;col-sm-4&quot;&gt;
              &lt;div class=&quot;input-group&quot;&gt;
                      &lt;span class=&quot;input-group-append&quot;&gt;
                          &lt;span class=&quot;input-group-text&quot;&gt;&lt;i
                                      class=&quot;livicon&quot; data-name=&quot;number&quot;
                                      data-size=&quot;18&quot; data-c=&quot;#000&quot;
                                      data-hc=&quot;#000&quot; data-loop=&quot;true&quot;&gt;&lt;/i&gt;&lt;/span&gt;
                      &lt;/span&gt;
                  &lt;input type=&quot;date&quot; class=&quot;form-control&quot;
                  placeholder=&quot;dd/yy/mm&quot; id=&quot;reg_date&quot; name=&quot;reg_date&quot;&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  
  
  
  </code></pre>
  <p>edit.blade.php</p>
  <pre><code>
  
  
   &lt;div class=&quot;card-body&quot;&gt;
                  {!! Form::model($warehouse, ['route' =&gt; ['admin.warehouses.update', collect($warehouse)-&gt;first() ], 'method' =&gt; 'patch']) !!}
                  {{ csrf_field() }}
                  @include('admin.warehouses.fields')
  
                  {!! Form::close() !!}
                  &lt;/div&gt;
  
  </code></pre>
  <p>create.blade.php</p>
  <pre><code>&lt;div class=&quot;card-body&quot;&gt;
              {!! Form::open(['route' =&gt; 'admin.warehouses.store']) !!}
              {{ csrf_field() }}
                  @include('admin.warehouses.fields')
  
              {!! Form::close() !!}
          &lt;/div&gt;
  
  </code></pre>
  <p>I have tried using {{old()}} but it won't load, the form fields are the same as the tables.
  when I use the same with laravel collective,it work perfectly fine.</p>
  <pre><code>
  
  {!! Form::number('wh_no', null, ['class' =&gt; 'form-control','class'=&gt;'livicon','data-name'=&gt;'user']) !!}
  
  </code></pre>