Answer the question
In order to leave comments, you need to log in
Laravel After adding autoload - files to composer.json, post requests are no longer sent and cookies are not created on any pages (erorr 419)?
My initial task was to make functions that will be available from anywhere in Laravel.
On the Internet, I found that through composer.json autoload you can connect a file in which you specify this function and call it from anywhere without any problems.
So, as I did, I will write as accurately as possible so as not to miss anything:
1) I created a file with the app/Helper/addlog.php function (as it turned out later, the contents of the file do not affect the presence of a problem, I made it empty for the sake of testing)
2) I added the composer. json to make it look like this
"autoload": {
"psr-4": {
"App\\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
],
"files": [
"app/Helper/addlog.php"
]
}
addlog('name_files', 'text_log');
"files": [
"app/Helper/addlog.php"
]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question