質問編集履歴

2

api使用用途の追加

2018/02/02 02:58

投稿

SystemRyota
SystemRyota

スコア24

test CHANGED
File without changes
test CHANGED
@@ -67,3 +67,11 @@
67
67
  });
68
68
 
69
69
  ```
70
+
71
+
72
+
73
+
74
+
75
+ ###### 追加
76
+
77
+ ログインフォームにてログインした後、apiを使用します。

1

ルーティングのソースを記載しました。

2018/02/02 02:57

投稿

SystemRyota
SystemRyota

スコア24

test CHANGED
File without changes
test CHANGED
@@ -11,3 +11,59 @@
11
11
  apiのコントローラにてユーザ情報を取得し、Modelに渡したいのですが、
12
12
 
13
13
  どうすれば良いのでしょうか。
14
+
15
+
16
+
17
+ routes/api.php
18
+
19
+ ```
20
+
21
+ <?php
22
+
23
+
24
+
25
+ use Illuminate\Http\Request;
26
+
27
+ use Illuminate\Support\Facades\Auth;
28
+
29
+
30
+
31
+ /*
32
+
33
+ |--------------------------------------------------------------------------
34
+
35
+ | API Routes
36
+
37
+ |--------------------------------------------------------------------------
38
+
39
+ |
40
+
41
+ | Here is where you can register API routes for your application. These
42
+
43
+ | routes are loaded by the RouteServiceProvider within a group which
44
+
45
+ | is assigned the "api" middleware group. Enjoy building your API!
46
+
47
+ |
48
+
49
+ */
50
+
51
+
52
+
53
+ Route::group(['namespace' => 'API'], function() {
54
+
55
+ Route::get('***/***', '***@***');
56
+
57
+ Route::get('***/***', '***@***');
58
+
59
+
60
+
61
+ Route::post('***/***/***', '***@create');
62
+
63
+ Route::post('***/***/***', '***@save');
64
+
65
+ Route::post('***/***/***', '***@update');
66
+
67
+ });
68
+
69
+ ```