2021-12-22

Call to undefined function in Laravel controller

In my controller, I created a function named getJSON(). However, for some reason, I keep getting the following error.

Call to undefined function App\Http\Controllers\getJSON()

Can someone please teach me how to fix this error?

Controller

function response($return = [], $params = [])
{
    $return = (array) getJSON($return);
    $error = true;
    if (isset($return['error'])) {
        if (is_bool($return['error'])) {
            if ($return['error'] === false) {
                $error = false;
            }
        } elseif (is_string($return['error'])) {
            if ($return['error'] === "false") {
                $error = false;
            }
        }
    }
    if (!$error) {
        $data_param = '';
        if (isset($params['data_param'])) {
            $data_param = $params['data_param'];
        }
        if (isset($return[$data_param])) {
            $return = (array) $return[$data_param];
        }
    }
    
    return $return;
}


from Recent Questions - Stack Overflow https://ift.tt/3EimDH8
https://ift.tt/eA8V8J

No comments:

Post a Comment