Am new to Laravel and i have been trying to create a helper function like i would in codeigniter within a demo package am currently developing. But, you know, being knew to the framework it seems a little bit hard to get that done as i have applied some helps i could find online to no avail.
My Directory Structure Looks like So:
I have just one function in the app.php file
if (! function_exists('baxi_services')) {
function baxi_services()
{
$data = ['web dev', 'web design', 'SEO'];
return json_decode($data, JSON_PRETTY_PRINT);
}
}
The composer.json file has these lines:
"autoload": {
"psr-4": {
"Courage\\Baxi\\": "src/"
},
"files": [
"src/helpers/app.php"
]
}
And the problem is, when i call this function in my controller like so:
return baxi_services();
i get the following Error:
Call to undefined function Courage\Baxi\Http\Controllers\baxi_services()
I have all ran composer dum-autoload command in my terminal but that doesnt solve the problem