Closed 377960738 closed 2 years ago
Install APCU extension (optional) (recommend)
Opening APCU can reduce whether to rely on injection detection
whether to rely on injection
Modify the configuration config/app.php file add action_inject = true
config/app.php
action_inject = true
You need to manually turn on this ability, because dependency injection will have mild performance loss
// URL http://127.0.0.1:8787/test/12 // Route Route::get('/test/{id}', 'app/Test@index'); // Controller public function index(Request $request, ServiceTest $test, int $id) { return json([ $request->header('user-agent'), $test->model->toArray(), $id, ]); } // response
{ "agent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:104.0) Gecko\/20100101 Firefox\/104.0", "data":[], "id":12 }
Thanks
How to take effect
Install APCU extension (optional) (recommend)
Modify the configuration
config/app.php
file addaction_inject = true
Example