2017-02-26 65 views
0

i.stack.imgur.com/R8dUd.pngsave()方法只寫最後一條記錄在我的形式

我想保存在我的數據庫中的多個形式記錄,但它只是在我的刀片循環寫最後一個記錄。

//This is my loop in blade. for getting multiple informations 
@for ($i = 1; $i < $package->package_for + 1; $i++) 
+0

你能展現形式呢? –

+0

這是我的刀鋒形式。 –

回答

0
@for ($i = 1; $i < $package->package_for + 1; $i++) 
<div class="container information"> 

    <div class="row"> 

     <div class="col-md-8 col-md-offset-2"> 
      <div class="panel panel-default"> 
       <div class="panel-heading"><h3>Guest {{ $i }}</h3></div> 
       <div class="panel-body"> 






        <form class="form-horizontal" action="{{ route('information', ['id' => $package->id]) }}" role="form" method="POST"> 


        <div class="col-md-9 col-md-offset-2 fullname"> 
         <div class="gender"> 
         <label> &nbsp</label> 
         <select type="text" id="gender" class="form-control col-md-1" name="gender" required> 
               <option value="1">Mr</option> 
               <option value="2">Mrs</option> 
              </select> 
         </div> 

         <div class="form-group{{ $errors->has('firstname') ? ' has-error' : '' }}"> 
           <label> First Name</label> 
           <input id="firstname" placeholder="First Name" type="text" class="form-control" name="firstname" required> 



           @if ($errors->has('firstname')) 
            <span class="help-block"> 
             <strong>{{ $errors->first('firstname') }}</strong> 
            </span> 
           @endif 
          </div> 
         <div class="form-group{{ $errors->has('lastname') ? ' has-error' : '' }}"> 
           <label> First Name</label> 
           <input id="lastname" placeholder="Last Name" type="text" class="form-control" name="lastname" required> 



           @if ($errors->has('lastname')) 
            <span class="help-block"> 
             <strong>{{ $errors->first('lastname') }}</strong> 
            </span> 
           @endif 
          </div> 
         </div> 

         <div class="form-group{{ $errors->has('contact_number') ? ' has-error' : '' }}"> 
          <label for="contact_number" class="col-md-4 control-label">&nbsp</label> 

          <div class="col-md-6"> 
           <label>Contact Number</label> 
           <input id="contact_number_number" placeholder="Contact Number" type="contact_number" class="form-control" name="contact_number" required> 

           @if ($errors->has('contact_number')) 
            <span class="help-block"> 
             <strong>{{ $errors->first('contact_number') }}</strong> 
            </span> 
           @endif 
          </div> 
         </div> 
         <div class="form-group{{ $errors->has('age') ? ' has-error' : '' }}"> 
          <label for="age" class="col-md-4 control-label">&nbsp</label> 

          <div class="col-md-6"> 
           <label>Age</label> 
           <select type="text" id="age" class="form-control col-md-1" name="age" required> 
           @for ($b = 1; $b < 50; $b++) 
           <option value="$i">{!! $b !!}</option> 

           @endfor 
              </select> 

           @if ($errors->has('age')) 
            <span class="help-block"> 
             <strong>{{ $errors->first('age') }}</strong> 
            </span> 
           @endif 
          </div> 
         </div> 
         <div class="form-group{{ $errors->has('address') ? ' has-error' : '' }}"> 
          <label for="address" class="col-md-4 control-label">&nbsp</label> 

          <div class="col-md-6"> 
           <label>Address</label> 
           <input id="address" placeholder="Address" type="address" class="form-control" name="address" value="{{ old('address') }}" required> 

           @if ($errors->has('address')) 
            <span class="help-block"> 
             <strong>{{ $errors->first('address') }}</strong> 
            </span> 
           @endif 
          </div> 
         </div> 

       </div> 
      </div> 
     </div> 
    </div> 
</div> 
@endfor 
<div class="form-group"> 
          <div class="col-md-6 col-md-offset-4"> 
           <button type="submit" class="btn btn-primary" href="{{ route('package.addToCart', ['id' => $package->id]) }}"> 
             Book Package 
           </button> 

           {{ csrf_field() }} 
          </div> 
         </div> 
</form> 
相關問題