- Create a file inside app folder like helper.php.
- Helper function will load automatically on all pages.
- First i have to register my helper function in autoload.php file.
- Go to composer.json file and find autoload object and paste this code here
“autoload”: {
“files”: [
“app/helper.php”
],
“psr-4”: {
“App\\”: “app/”,
“Database\\Factories\\”: “database/factories/”,
“Database\\Seeders\\”: “database/seeders/”
}
},
Then autoload the composer by using this command
composer dump-autoload