form.blade.php 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <!DOCTYPE html>
  2. <html lang="ru">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Тест Laravel</title>
  7. {{-- Стили остаются без изменений --}}
  8. <style>
  9. * { margin: 0; padding: 0; box-sizing: border-box; }
  10. body {
  11. font-family: Arial, sans-serif;
  12. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  13. min-height: 100vh;
  14. display: flex;
  15. justify-content: center;
  16. align-items: center;
  17. padding: 20px;
  18. }
  19. .container {
  20. background: white;
  21. padding: 40px;
  22. border-radius: 10px;
  23. box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  24. max-width: 500px;
  25. width: 100%;
  26. }
  27. h1 {
  28. color: #333;
  29. margin-bottom: 10px;
  30. text-align: center;
  31. }
  32. .subtitle {
  33. color: #666;
  34. text-align: center;
  35. margin-bottom: 30px;
  36. font-size: 14px;
  37. }
  38. .form-group {
  39. margin-bottom: 20px;
  40. }
  41. label {
  42. display: block;
  43. margin-bottom: 5px;
  44. color: #333;
  45. font-weight: bold;
  46. }
  47. input, textarea, select {
  48. width: 100%;
  49. padding: 12px;
  50. border: 2px solid #e1e1e1;
  51. border-radius: 5px;
  52. font-size: 14px;
  53. transition: border-color 0.3s;
  54. background-color: white;
  55. }
  56. input:focus, textarea:focus, select:focus {
  57. outline: none;
  58. border-color: #667eea;
  59. }
  60. textarea {
  61. resize: vertical;
  62. min-height: 100px;
  63. }
  64. .btn {
  65. width: 100%;
  66. padding: 12px;
  67. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  68. color: white;
  69. border: none;
  70. border-radius: 5px;
  71. font-size: 16px;
  72. font-weight: bold;
  73. cursor: pointer;
  74. transition: transform 0.2s;
  75. }
  76. .btn:hover {
  77. transform: translateY(-2px);
  78. }
  79. .alert {
  80. padding: 15px;
  81. border-radius: 5px;
  82. margin-bottom: 20px;
  83. }
  84. .alert-success {
  85. background: #d4edda;
  86. color: #155724;
  87. border: 1px solid #c3e6cb;
  88. }
  89. .alert-error {
  90. background: #f8d7da;
  91. color: #721c24;
  92. border: 1px solid #f5c6cb;
  93. }
  94. .error-text {
  95. color: #e74c3c;
  96. font-size: 12px;
  97. margin-top: 5px;
  98. }
  99. </style>
  100. </head>
  101. <body>
  102. <div class="container">
  103. <h1>Laravel Форма</h1>
  104. <div style="text-align: center; margin-bottom: 20px;">
  105. <a href="{{ route('admin.index') }}" style="color: #667eea; text-decoration: none; font-size: 14px;">
  106. 📋 Посмотреть все отправленные данные
  107. </a>
  108. </div>
  109. <p class="subtitle">Laravel {{ app()->version() }} | PHP {{ phpversion() }}</p>
  110. @if(session('success'))
  111. <div class="alert alert-success">
  112. {{ session('success') }}
  113. </div>
  114. @endif
  115. @if($errors->any())
  116. <div class="alert alert-error">
  117. <strong>Ошибки:</strong>
  118. <ul style="margin-top: 10px; margin-left: 20px;">
  119. @foreach($errors->all() as $error)
  120. <li>{{ $error }}</li>
  121. @endforeach
  122. </ul>
  123. </div>
  124. @endif
  125. <form action="{{ route('form.submit') }}" method="POST">
  126. @csrf
  127. <div class="form-group">
  128. <label for="name">Имя:</label>
  129. <input
  130. type="text"
  131. id="name"
  132. name="name"
  133. value="{{ old('name') }}"
  134. placeholder="Введите ваше имя"
  135. >
  136. @error('name')
  137. <div class="error-text">{{ $message }}</div>
  138. @enderror
  139. </div>
  140. <div class="form-group">
  141. <label for="email">Email:</label>
  142. <input
  143. type="email"
  144. id="email"
  145. name="email"
  146. value="{{ old('email') }}"
  147. placeholder="your@email.com"
  148. >
  149. @error('email')
  150. <div class="error-text">{{ $message }}</div>
  151. @enderror
  152. </div>
  153. <div class="form-group">
  154. <label for="category_id">Категория:</label>
  155. <select name="category_id" id="category_id">
  156. <option value="" disabled selected>-- Выберите категорию --</option>
  157. @foreach($categories as $category)
  158. <option value="{{ $category->id }}" {{ old('category_id') == $category->id ? 'selected' : '' }}>
  159. {{ $category->name }}
  160. </option>
  161. @endforeach
  162. </select>
  163. @error('category_id')
  164. <div class="error-text">{{ $message }}</div>
  165. @enderror
  166. </div>
  167. <div class="form-group">
  168. <label for="message">Сообщение:</label>
  169. <textarea
  170. id="message"
  171. name="message"
  172. placeholder="Минимум 10 символов..."
  173. >{{ old('message') }}</textarea>
  174. @error('message')
  175. <div class="error-text">{{ $message }}</div>
  176. @enderror
  177. </div>
  178. <button type="submit" class="btn">
  179. Отправить форму
  180. </button>
  181. </form>
  182. </div>
  183. </body>
  184. </html>