質問編集履歴
1
ルーティングの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -64,6 +64,60 @@
|
|
64
64
|
|
65
65
|
```
|
66
66
|
|
67
|
+
```php
|
68
|
+
|
69
|
+
// web.php
|
70
|
+
|
71
|
+
<?php
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
use Illuminate\Support\Facades\Route;
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
Route::get('/', function () {
|
80
|
+
|
81
|
+
return view('welcome');
|
82
|
+
|
83
|
+
});
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
Auth::routes();
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
Route::get('/home', 'HomeController@index')->name('home');
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
// ログイン状態
|
96
|
+
|
97
|
+
Route::group(['middleware' => 'auth'], function() {
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
// ユーザ関連
|
102
|
+
|
103
|
+
Route::resource('users', 'UsersController', ['only' => ['index', 'show', 'edit', 'update']]);
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
// フォロー/フォロー解除を追加
|
108
|
+
|
109
|
+
Route::post('users/{user}/follow', 'UsersController@follow')->name('follow');
|
110
|
+
|
111
|
+
Route::delete('users/{user}/unfollow', 'UsersController@unfollow')->name('unfollow');
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
});
|
116
|
+
|
117
|
+
```
|
118
|
+
|
119
|
+
|
120
|
+
|
67
121
|
|
68
122
|
|
69
123
|
### 試したこと
|