Add debugging to Laravel API middleware
Add it to the middleware like that, then you can debug by appending ?\ debug... (as taught in the lecture...) Of course, you need to install laravel debugbar.
GGAMI
public function handle($request, Closure $next)
{
$response = $next($request);
if ($response instanceof JsonResponse && app('debugbar')->isEnabled() && $request->has('_debug')) {
$response->setData($response->getData(true) + [
'_debugbar' => Arr::only(app('debugbar')->getData(), 'queries')
]);
}
return $response;
}Add it to the middleware like that, then you can debug by appending ?_debug... (as taught in the lecture...)
Of course, you need to install laravel-debugbar.