json([ 'success' => true, 'data' => $data, 'hashkey' => $hashkey, 'message'=>$message, ]); } public static function returnFalseOrNull($hashfromRequest) { if ($hashfromRequest) { return response()->json(['success' => false]); } else { return null; } } public static function returnUnauthorized() { return response()->json(['success' => false, 'message' => 'Unauthorized '], 403); } public static function returnIncorrectDetails() { return self::returnError('Incomplete/Incorrect Details!'); } public static function returnError($errorText, $status = 500, $data = []) { return response()->json(['success' => false, 'message' => $errorText, 'data' => $data], $status); } public static function getTargetHash() { $target = request()->input('target'); if (!$target) { return null; } if (is_object($target) || is_array($target)) { try { $target = $target['target']; return $target; } catch (\Throwable $th) { return null; } } return $target; } public static function getTargetData() { $target = request()->input('data'); return $target; } }