Someone can explain to a beginner of languages that is understandable how to connect your class in Laravel correctly? Already boiling head: service providers, packages, facades, etc.
2 answers
Hello. For accuracy, we will create a separate folder where all our classes will be saved. The folder is called library (or whatever you want). 
Create some class inside this folder, for example, Setting.
Then in the composer.json file in the autoload-> classmap section we add the path of our folder, for example "library".
Then in the console call the command dump-autoload composer.
And that's all, our class is ready to use.
|
use Путь/До/Класса/myClass; public function test() { $class = new myClass; } Class
namespace Путь\До\Класса; class myClass { #введите сюда код } |
