dimanche 5 janvier 2020

Laravel - if condition for select

My if condition for selected Input is not showing anyhing. Here is my create.blade.php:

...
{!! Form::open(['action' => 'PostsController@store', 'method' => 'POST']) !!}
   <div class="column">
      <label for="title">Title</label></br>
      <input name="title" type="text" placeholder="" class="form-control">
   </div>
   </br>
   <div class="column">
      <label for="brand">Brand</label></br>
      <select class="form-control" id="soflow" name="brand">
         <option value="" disabled selected>Select your option</option>
         <option value="Volkswagen">Volkswagen</option>
         <option value="BMW">BMW</option>
         <option value="Audi">Audi</option>
      </select>
   </div>
   </br>
   @if(Input::has('brand') == 'Volkswagen')
      <div class="column">
         <label for="model">Model</label></br>
         <select class="form-control" id="soflow" name="model">
            <option value="" disabled selected>Select your option</option>
            <option value="Golf1">Golf 1</option>
            <option value="Golf2">Golf 2</option>
            <option value="Golf3">Golf 3</option>
        </select>
     </div>
   @endif
{!! Form::close() !!}
...

But after this my select for model is not showing at all and I just need to show specific models if select input(brand) is for Volkswagen. Any solutions? Please help. Thank you!

Aucun commentaire:

Enregistrer un commentaire