質問編集履歴

1

ルーティング追加

2018/12/30 10:32

投稿

Ryosukevvvv
Ryosukevvvv

スコア19

test CHANGED
File without changes
test CHANGED
@@ -10,6 +10,48 @@
10
10
 
11
11
 
12
12
 
13
+ ```web
14
+
15
+ //ユーザー機能
16
+
17
+ Route::group(['middleware' => 'auth'], function(){
18
+
19
+ Route::resource('users', 'UsersController', ['only' => 'show']);
20
+
21
+
22
+
23
+ //レシピ関係
24
+
25
+ Route::resource('recipes', 'RecipesController');
26
+
27
+
28
+
29
+ //お気に入り関係(ユーザー)
30
+
31
+ Route::group(['prefix' => 'users/{id}'], function(){
32
+
33
+ Route::get('favorites', 'UsersController@favorites')->name('users.favorites');
34
+
35
+ });
36
+
37
+ //お気に入り関係(レシピ)
38
+
39
+ Route::group(['prefix' => 'recipes/{id}'], function(){
40
+
41
+ Route::post('favorite', 'FavoritesController@store')->name('favorites.favorite');
42
+
43
+ Route::delete('unfavorite', 'FavoritesController@destroy')->name('favorites.unfavorite');
44
+
45
+ });
46
+
47
+
48
+
49
+ });
50
+
51
+ ```
52
+
53
+
54
+
13
55
  ```User
14
56
 
15
57
  namespace App;