Answer the question
In order to leave comments, you need to log in
How to include an additional file in Laravel?
I created a file with the API connection code in the Config folder. In the main file, using require, I connected this file, but in the end I get an error that the file was not found, although the path and file name were specified correctly.
I just started learning Laravel and haven't had time to figure out all the folders yet. Help pliz
Answer the question
In order to leave comments, you need to log in
require does not need to be used.
There should be no logic in the config folder. this is a folder for configuration files, they are automatically connected and accessed through the global config ()
function.
When you create any file with your hands and not through commands, you need to execute composer dump-autoload.
If you create a folder, you need to add it to the composer config because it will not index it.
In general, there is a fairly short documentation. It is better to read it in its entirety to understand how it works and what it can do.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question