php - Custom Helper is not loading correctly in Laravel -
i'm trying load helper file called application_helper.php using composer.json, , i'm getting entire dump of file on every page including composer update command. telling function not exist , throwing 500 error on ajax request. instead of loading it, it's printing out entire file. what's confusing works on everyone's localhost, on our aws server, it's giving issue. great.
my files include of:
composer.json
"autoload": { "classmap": [ "database" ], "psr-4": { "app\\": "app/" }, "files": [ "app/helpers/application_helper.php" ] },
app/helpers/application_helper.php
if (!function_exists('mavrick_rsp')) { /* @param $viewroute string @param $data associate/json @error boolean, optional @param associate/json, mergable userdata.... */ function mavrick_rsp($viewroute = false, $data = false, $error = false, $mergearray = array()) { $data = (is_array($data)) ? $data : jsontoarray($data); $mergearray = (is_array($mergearray)) ? $mergearray : jsontoarray($mergearray); $data = array_merge($mergearray, $data); return response::json(array( 'html' => ($viewroute) ? view::make($viewroute, ($data) ? $data : array())->render() : false, 'data' => $data, 'error' => $error, )); } } if (!function_exists('isjson')) { //todo: slow replace low index char parser... function isjson($string) { return is_string($string) && is_object(json_decode($string)) && (json_last_error() == json_error_none) ? true : false; } } if (!function_exists('jsontoarray')) { /* @param $json string(formated json string) when fail empty array returned!! */ function jsontoarray($json) { if(!isjson($json)){return array();} return json_decode($json, true); } }
the dump on page that's happening
($viewroute) ? view::make($viewroute, ($data) ? $data : array())->render() : false, 'data' => $data, 'error' => $error, )); } } if (!function_exists('isjson')) { //todo: slow replace low index char parser... function isjson($string) { return is_string($string) && is_object(json_decode($string)) && (json_last_error() == json_error_none) ? true : false; } } if (!function_exists('jsontoarray')) { /* @param $json string(formated json string) when fail empty array returned!! */ function jsontoarray($json) { if(!isjson($json)){return array();} return json_decode($json, true); } }
Comments
Post a Comment