Reputation: 374
I thought of creating a constants.php file in the config directory but didn't go ahead with it as it kinda contradicts the idea of "CONSTANTS" as anything in config can be changed at run time. So what are the best practices in storing constants in a laravel project without too many "require_once"s or "use"s ?
pointer to some public git project which uses a standard way to get this done would be great.
Upvotes: 1
Views: 119
Reputation: 929
you have to make constant in one file and use all over laravel than you have to make one file that can we write all the constant and costume functions.
Follow the steps
Make one Helper.php file in the your app->Http directory.
Write the all the constant and function there.
Then make following changes in your composer.josn
"files": [
"app/Http/helpers.php"
],
Then following command in your laravel project directory.
$ composer dumpautoload
Upvotes: 2