質問編集履歴
1
Laravel,phpのバージョンと、ソースコードを追記しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -15,6 +15,138 @@
|
|
15
15
|
|
16
16
|
|
17
17
|
この2秒の間、Laravelは何の処理をしているのでしょうか?どうすればAPIのレスポンスを速くできるでしょうか?
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
### コード
|
24
|
+
|
25
|
+
・<route/web.php>
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
<?php
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
Route::get('/', function () {
|
36
|
+
|
37
|
+
return redirect('api/documentation');
|
38
|
+
|
39
|
+
});
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
Auth::routes();
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
Route::group(['middleware' => ['assign.guard:api-web','jwt.auth']], function () {
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
Log::debug('web.php : '.microtime(true));
|
52
|
+
|
53
|
+
Route::get('api/manager/division/list', 'Api\DivisionController@division_list');
|
54
|
+
|
55
|
+
});
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
・<app\Http\Controllers\Api\DivisionController.php>
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
<?php
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
namespace App\Http\Controllers\Api;
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
use App\Http\Resources\Api\ApiStatus;
|
80
|
+
|
81
|
+
use App\Models\Division;
|
82
|
+
|
83
|
+
use App\Models\User;
|
84
|
+
|
85
|
+
use Illuminate\Support\Facades\DB;
|
86
|
+
|
87
|
+
use Log;
|
88
|
+
|
89
|
+
use Illuminate\Validation\Rule;
|
90
|
+
|
91
|
+
use Illuminate\Http\Request;
|
92
|
+
|
93
|
+
use Illuminate\Support\Facades\Auth;
|
94
|
+
|
95
|
+
use Illuminate\Support\Facades\Input;
|
96
|
+
|
97
|
+
use JWTAuth;
|
98
|
+
|
99
|
+
use JWTAuthException;
|
100
|
+
|
101
|
+
use Validator;
|
102
|
+
|
103
|
+
Log::debug('DivisionControllerの先頭: '.microtime(true));
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
class DivisionController extends BaseController{
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
protected $model = 'App\Models\User';
|
114
|
+
|
115
|
+
protected $model_division = 'App\Models\Division';
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
protected $division_resource = 'App\Http\Resources\ManagerDivisionListResource';
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
protected $division_collection = 'App\Http\Resources\ManagerDivisionListCollection';
|
124
|
+
|
125
|
+
protected $division_simple_collection = 'App\Http\Resources\DivisionSimpleCollection';
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
protected $relation = 'App\Http\Resources\UserCollectionRelation';
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
public function division_list(Request $request)
|
136
|
+
|
137
|
+
{
|
138
|
+
|
139
|
+
Log::debug('メソッドの先頭 : '.microtime(true));
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
}
|
144
|
+
|
145
|
+
}
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
18
150
|
|
19
151
|
|
20
152
|
|
@@ -49,3 +181,17 @@
|
|
49
181
|
|
50
182
|
|
51
183
|
よろしくお願いいたします。
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
### 補足
|
190
|
+
|
191
|
+
phpとLaravelのバージョンです。
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
PHP 7.4.7
|
196
|
+
|
197
|
+
Laravel 5.8.38
|