Sainath Krishnan
Sainath Krishnan

Reputation: 2139

Global files in Laravel

Where do I store a php file ( functions.php) in the laravel directory, so that I can call functions in it from any controller? I understand I am to include it in all the files where I have to use the functions, but I'm not very clear on where I need to put the file itself.

Upvotes: 0

Views: 774

Answers (1)

Anam
Anam

Reputation: 12199

You can put inside in your App directory.

After that add the following line to your App\start\global.php file

require app_path().'/functions.php';

That's it.

Upvotes: 1

Related Questions