airportForm.blade.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. @extends("base")
  2. @section("content")
  3. @if ($obj->id)
  4. <form action="/airport/edit/{{$obj->id}}" method="post">
  5. @else
  6. <form action="/airport/create/" method="post">
  7. @endif
  8. <div class="form-group">
  9. <label for="name">Имя аэропорта</label>
  10. <input type="text" class="form-control" value="{{$obj->name}}" name="name" id="name"
  11. placeholder="Введите имя">
  12. <label for="city">Город</label>
  13. <input type="text" class="form-control" value="{{$obj->city}}" name="city" id="city"
  14. placeholder="Введите город">
  15. <label for="planes">Самолеты</label>
  16. <select multiple class="form-control" name="planes[]" id="planes">
  17. @foreach($planes as $plane)
  18. <option value="{{$plane->id}}"
  19. @if ($plane->id == $obj->id)
  20. selected
  21. @endif
  22. >{{$plane}}</option>
  23. @endforeach
  24. </select>
  25. </div>
  26. <div>
  27. @if (count($errors) > 0)
  28. <div class="alert alert-danger">
  29. <ul>
  30. @foreach ($errors->all() as $error)
  31. <li>{{ $error }}</li>
  32. @endforeach
  33. </ul>
  34. </div>
  35. @endif
  36. </div>
  37. <button type="submit" class="btn btn-primary">Submit</button>
  38. @csrf
  39. </form>
  40. @stop