Monday, 6 November 2017

php - Overwrite laravel 5 helper function

I'm using the response() helper
very often and I just return the data with a message to the user. Now I have to include
the http status code as well, but I don't want to change every response (which is likely
bad anyway).



So I'm trying to overwrite the
response() helper function by creating my own
helpers.php within
app/Http/helpers.php.



When I add it to my composer files, it does
autoload the current helpers.php from the framework first and when I add it before the
autload include in bootstrap/global.php I wont be able to use
the app() and other Laravel
functions.



How would I be able to solve this
issue? I just want to include the status code as well in the response
array.

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print ...