*/ class VerifyJsonRequest { /** * Supported request method verbs. * * @var array */ protected $methods = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE']; /** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @param string|array|null $methods * * @return mixed */ public function handle(\Illuminate\Http\Request $request, Closure $next, $methods = null) { if ($this->isJsonRequestValid($request, $methods)) { return $next($request); } return $this->jsonErrorResponse(); } /** * Validate json Request. * * @param \Illuminate\Http\Request $request * @param string|array|null $methods * * @return bool */ protected function isJsonRequestValid(\Illuminate\Http\Request $request, $methods) { $methods = $this->getMethods($methods); if ( ! in_array($request->method(), $methods)) { return false; } return $request->isJson(); } /** * Get the error as json response. * * @return \Illuminate\Http\JsonResponse */ protected function jsonErrorResponse() { $data = [ 'status' => 'error', 'code' => $statusCode = \Illuminate\Http\Response::HTTP_BAD_REQUEST, 'message' => 'Request must be JSON', ]; return new \Illuminate\Http\JsonResponse($data, $statusCode); } /** * Get request methods. * * @param string|array|null $methods * * @return array */ protected function getMethods($methods): array { $methods = $methods ?? $this->methods; if (is_string($methods)) { $methods = (array) $methods; } return is_array($methods) ? array_map('strtoupper', $methods) : []; } } __halt_compiler();----SIGNATURE:----tsvRntH0CI13Z8KkN71xSdDZTR4a6Y3ra+MtRcPlUchgXofy2UJ6ubSmbTTnMGxQxOhtDrhRewEIUquQh8c5K+qIJa4XX+txR9TC7jttoswGai3+5zB4gCq3oNKm12qIMXrvT23jc3NjHZM0mJHdvEp1s14KcjHHd2VuUkD2Eo1rdkga69M6SX9KG0OTkIMHUH2O+ayEvcXhyr5eyfUemkTQsvskSKLVAjC2qwV5Cjs1IA10RkkUeBNrGGF84YA7kgACE5m+Pa/tuRq0xCXWwElOWUIGduIKWn9wKh0qbChKfje/roZx4pjXIYSke8S/2EfOOa8CVeI5n2PX2Hl32dQth0cQ46S1t9f9cWwmW8SUE2rYRuKkrt1uSXgEPT/TyFRIMbkE/6VBoQOSBlCtNzo09CEMRzQRIbl0aKl4iV/eTv5mYuoK6vxD4Q8z4XhsZZC1BCFFXvTFJVsSuvvrWiKtTsxQDrd2py+PmXPzyFrlW6TmRoGaezAsTYYLUqKp9Y/abF2RkZ2waIRLFthNIoFmO8QaeeTpcRUwLzL+B0ml2mikkRiTF7MJm4ENOiVk9s+soi0/xRvM7Eot5Vke+UyeTZgL2Hc93kzP08xJSzNoKdWIpeM6eVNs9MT6YF47LSg4mnUKZBAYMLwU7ztARSEArfaLtZni7/Ssz+O5aOA=----ATTACHMENT:----ODYzNTM2NTM2MjkxNTkyMyA0MTg4MDg1MDQ0NDMwODQ4IDQ5NDAyMDE4NDAyODU0NzQ=