質問編集履歴
1
routesとviewを追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -157,3 +157,145 @@
|
|
157
157
|
|
158
158
|
|
159
159
|
```
|
160
|
+
|
161
|
+
ーーーー追記ーーーーー
|
162
|
+
|
163
|
+
ルートでは、web.phpしかいじっていないので、web.phpをのせます
|
164
|
+
|
165
|
+
```php
|
166
|
+
|
167
|
+
<?php
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
/*
|
172
|
+
|
173
|
+
|--------------------------------------------------------------------------
|
174
|
+
|
175
|
+
| Web Routes
|
176
|
+
|
177
|
+
|--------------------------------------------------------------------------
|
178
|
+
|
179
|
+
|
|
180
|
+
|
181
|
+
| Here is where you can register web routes for your application. These
|
182
|
+
|
183
|
+
| routes are loaded by the RouteServiceProvider within a group which
|
184
|
+
|
185
|
+
| contains the "web" middleware group. Now create something great!
|
186
|
+
|
187
|
+
|
|
188
|
+
|
189
|
+
*/
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
Route::get('/', function () {
|
194
|
+
|
195
|
+
return view('welcome');
|
196
|
+
|
197
|
+
});
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
Route::get('hello', 'HelloController@index');
|
202
|
+
|
203
|
+
Route::post('hello', 'HelloController@post');
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
// use App\Http\Middleware\HelloMiddleware; を追記
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
Route::get('hello', 'HelloController@index');
|
212
|
+
|
213
|
+
```
|
214
|
+
|
215
|
+
viewだとこれをいじったので、index.blade.phpを載せます
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
```php
|
220
|
+
|
221
|
+
@extends('layouts.helloapp')
|
222
|
+
|
223
|
+
@section('title','Index')
|
224
|
+
|
225
|
+
@section('menubar')
|
226
|
+
|
227
|
+
@parent
|
228
|
+
|
229
|
+
インデックスページ
|
230
|
+
|
231
|
+
@endsection
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
@section('content')
|
236
|
+
|
237
|
+
<p>{{$msg}}</p>
|
238
|
+
|
239
|
+
@if (count($errors) > 0)
|
240
|
+
|
241
|
+
<p>入力に問題があります。再入力して下さい。</p>
|
242
|
+
|
243
|
+
@endif
|
244
|
+
|
245
|
+
<table>
|
246
|
+
|
247
|
+
<form action="/hello" method="post">
|
248
|
+
|
249
|
+
{{ csrf_field() }}
|
250
|
+
|
251
|
+
@if ($errors->has('name'))
|
252
|
+
|
253
|
+
<tr><th>ERROR</th><td>{{$errors->first('name')}}</td></tr>
|
254
|
+
|
255
|
+
@endif
|
256
|
+
|
257
|
+
<tr><th>name: </th><td><input type="text" name="name"
|
258
|
+
|
259
|
+
value="{{old('name')}}"></td></tr>
|
260
|
+
|
261
|
+
@if ($errors->has('mail'))
|
262
|
+
|
263
|
+
<tr><th>ERROR</th><td>{{$errors->first('mail')}}</td></tr>
|
264
|
+
|
265
|
+
@endif
|
266
|
+
|
267
|
+
<tr><th>mail: </th><td><input type="text" name="mail"
|
268
|
+
|
269
|
+
value="{{old('mail')}}"></td></tr>
|
270
|
+
|
271
|
+
@if ($errors->has('age'))
|
272
|
+
|
273
|
+
<tr><th>ERROR</th><td>{{$errors->first('age')}}</td></tr>
|
274
|
+
|
275
|
+
@endif
|
276
|
+
|
277
|
+
<tr><th>age: </th><td><input type="text" name="age"
|
278
|
+
|
279
|
+
value="{{old('age')}}"></td></tr>
|
280
|
+
|
281
|
+
<tr><th></th><td><input type="submit" value="send"></td></tr>
|
282
|
+
|
283
|
+
</form>
|
284
|
+
|
285
|
+
</table>
|
286
|
+
|
287
|
+
@endsection
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
@section('footer')
|
294
|
+
|
295
|
+
copyright 2017 tuyono.
|
296
|
+
|
297
|
+
@endsection
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
```
|