<?php

if (!function_exists('sendError')) {

    /**
     * description
     *
     * @param
     * @return
     */
    
    function sendError($error, $errorMessages = [], $code = 404)
    {
        $response = [
            'success' => false,
            'message' => $error,
        ];

        if (!empty($errorMessages)) {
            $response['data'] = $error;
        }

        return response()->json($response, $code);
    }
}
