Skip to content

Instantly share code, notes, and snippets.

View noxidsoft's full-sized avatar
Working on new projects

Noel Dixon (Business) noxidsoft

Working on new projects
View GitHub Profile
noxidsoft /
Created December 16, 2022 05:53
meSingh / JsonMiddleware.php
Last active July 11, 2022 09:19
If you are using laravel as api only, you might want to return JSON on every request, even on errors/exceptions. The easiest way to do so is using this middleware globally.
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
class JsonMiddleware
public function handle(Request $request, Closure $next)