質問編集履歴

4

ルーティング、テーブル定義の追加

2019/11/17 06:25

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -271,3 +271,181 @@
271
271
  }
272
272
 
273
273
  ```
274
+
275
+
276
+
277
+ テーブル定義
278
+
279
+
280
+
281
+ ```php
282
+
283
+ <?php
284
+
285
+
286
+
287
+ use Illuminate\Database\Migrations\Migration;
288
+
289
+ use Illuminate\Database\Schema\Blueprint;
290
+
291
+ use Illuminate\Support\Facades\Schema;
292
+
293
+
294
+
295
+ class CreateUsersTable extends Migration
296
+
297
+ {
298
+
299
+ /**
300
+
301
+ * Run the migrations.
302
+
303
+ *
304
+
305
+ * @return void
306
+
307
+ */
308
+
309
+ public function up()
310
+
311
+ {
312
+
313
+ Schema::create('users', function (Blueprint $table) {
314
+
315
+ $table->bigIncrements('id');
316
+
317
+ $table->string('name');
318
+
319
+ $table->string('email')->unique();
320
+
321
+ $table->timestamp('email_verified_at')->nullable();
322
+
323
+ $table->string('password');
324
+
325
+ $table->rememberToken();
326
+
327
+ $table->timestamps();
328
+
329
+ });
330
+
331
+ }
332
+
333
+
334
+
335
+ /**
336
+
337
+ * Reverse the migrations.
338
+
339
+ *
340
+
341
+ * @return void
342
+
343
+ */
344
+
345
+ public function down()
346
+
347
+ {
348
+
349
+ Schema::dropIfExists('users');
350
+
351
+ }
352
+
353
+ }
354
+
355
+
356
+
357
+ ```
358
+
359
+
360
+
361
+ ルーティング
362
+
363
+
364
+
365
+ ```php
366
+
367
+ <?php
368
+
369
+
370
+
371
+ /*
372
+
373
+ |--------------------------------------------------------------------------
374
+
375
+ | Web Routes
376
+
377
+ |--------------------------------------------------------------------------
378
+
379
+ |
380
+
381
+ | Here is where you can register web routes for your application. These
382
+
383
+ | routes are loaded by the RouteServiceProvider within a group which
384
+
385
+ | contains the "web" middleware group. Now create something great!
386
+
387
+ |
388
+
389
+ */
390
+
391
+
392
+
393
+ Route::get('/', function () {
394
+
395
+ return view('welcome');
396
+
397
+ });
398
+
399
+
400
+
401
+ Route::get('', 'Top\TopController@top');
402
+
403
+
404
+
405
+ Route::get('top', 'Top\TopController@top');
406
+
407
+
408
+
409
+ Route::get('search', 'Top\TopController@search');
410
+
411
+
412
+
413
+ Route::get('logout', 'Auth\LoginController@logout', function () {
414
+
415
+ return abort(404);
416
+
417
+ });
418
+
419
+
420
+
421
+ Route::group(['prefix' => 'teacher'], function() {
422
+
423
+ Route::get('login', 'Teacher\TeacherController@login');
424
+
425
+ Route::get('index', 'Teacher\TeacherController@index')->middleware('auth');
426
+
427
+ Route::get('edit', 'Teacher\TeacherController@edit')->middleware('auth');
428
+
429
+ Route::post('edit', 'Teacher\TeacherController@create')->middleware('auth');
430
+
431
+ });
432
+
433
+
434
+
435
+ Route::group(['prefix' => 'question'], function() {
436
+
437
+ Route::get('index', 'Question\QuestionController@index');
438
+
439
+ });
440
+
441
+
442
+
443
+ Auth::routes();
444
+
445
+
446
+
447
+ Route::get('/home', 'HomeController@index')->name('home');
448
+
449
+
450
+
451
+ ```

3

リンクの修正

2019/11/17 06:25

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  inputのvalue属性で表示することはできています。
10
10
 
11
- https://gyazo.com/e010fe42552c12545e6b9cd452d45bac
11
+ [データベースから名前を取得している画面](https://gyazo.com/e010fe42552c12545e6b9cd452d45bac)
12
12
 
13
13
 
14
14
 

2

モデルの追加

2019/11/17 05:52

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -177,3 +177,97 @@
177
177
  }
178
178
 
179
179
  ```
180
+
181
+
182
+
183
+ Userモデル
184
+
185
+ ```php
186
+
187
+ <?php
188
+
189
+
190
+
191
+ namespace App;
192
+
193
+
194
+
195
+ use Illuminate\Contracts\Auth\MustVerifyEmail;
196
+
197
+ use Illuminate\Foundation\Auth\User as Authenticatable;
198
+
199
+ use Illuminate\Notifications\Notifiable;
200
+
201
+
202
+
203
+ class User extends Authenticatable
204
+
205
+ {
206
+
207
+ use Notifiable;
208
+
209
+
210
+
211
+ /**
212
+
213
+ * The attributes that are mass assignable.
214
+
215
+ *
216
+
217
+ * @var array
218
+
219
+ */
220
+
221
+ protected $fillable = [
222
+
223
+ 'name', 'email', 'password',
224
+
225
+ ];
226
+
227
+
228
+
229
+ /**
230
+
231
+ * The attributes that should be hidden for arrays.
232
+
233
+ *
234
+
235
+ * @var array
236
+
237
+ */
238
+
239
+ protected $hidden = [
240
+
241
+ 'password', 'remember_token',
242
+
243
+ ];
244
+
245
+
246
+
247
+ /**
248
+
249
+ * The attributes that should be cast to native types.
250
+
251
+ *
252
+
253
+ * @var array
254
+
255
+ */
256
+
257
+ protected $casts = [
258
+
259
+ 'email_verified_at' => 'datetime',
260
+
261
+ ];
262
+
263
+
264
+
265
+ public static $rules = array(
266
+
267
+ 'name' => 'required',
268
+
269
+ );
270
+
271
+ }
272
+
273
+ ```

1

誤字

2019/11/17 05:42

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -60,7 +60,7 @@
60
60
 
61
61
  <div>
62
62
 
63
- <form action="{{ action('Teacher\TeacherController@edit') }}" method="post" enctype="multipart/form-data">
63
+ <form action="{{ action('Teacher\TeacherController@create') }}" method="post" enctype="multipart/form-data">
64
64
 
65
65
  {{ csrf_field() }}
66
66