There's a big extension for laravel: debugbar. But what if I have a REST API. With the same lack of interface. How can I profile this type of application?
Instead of returning an answer, send it to the view:
return \View::make('debug', ['data' => $response]);
instead
//return response()->json($response);
(don't forget to create a view in which you echo data)
You can try this middleware
<?php namespace App\Http\Middleware; use Closure; use Illuminate\Http\JsonResponse; class ProfileJsonResponse { /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { $response = $next($request); if ( $response instanceof JsonResponse && app()->bound('debugbar') && app('debugbar')->isEnabled() && is_object($response->getData()) ) { $response->setData($response->getData(true) + [ '_debugbar' => app('debugbar')->getData(), ]); } return $response; } }
Link https://github.com/barryvdh/laravel-debugbar/issues/252
Source: https://habr.com/ru/post/1570166/More articles:Вызовите IronPython из стандартного Python - pythonRetrieving dates from a xts object based on vaule - dateImitation of Android GCM - androidThe only URL for multiple [sharepoint] URLs is dnsThe number of bytes in the unix file per line is unixHow to cut off options -b and -c to become different with internationalization - bashIntegrate firebase with Parse - firebaseWhat about password_hash () in PHP? - phpThe right way to create salted hash passwords - securityangular.forEach Nested Promises Resolution - javascriptAll Articles