Home >Backend Development >PHP Tutorial >The laravel framework controller calls the model layer and reports an error:
Laravel framework controller calls the model layer and reports an error:
The directory structure is as follows:
zcbo in the vender directory is a package customized by me;
Save information as follows:
The directory structure is as follows:
The controller code is as follows:
The model layer code is as follows:
Question supplement composer.json in zcbo directory
Supplementary question:
composer update error:
composer.json file:
Laravel framework controller calls the model layer and reports an error:
The directory structure is as follows:
zcbo in the vender directory is a package customized by me;
Save information as follows:
The directory structure is as follows:
The controller code is as follows:
The model layer code is as follows:
Question supplement composer.json in zcbo directory
Supplementary question:
composer update error:
composer.json file:
Post the composer.json in your zcbo directory and take a look. There should be an error in the psr-4 part. Let’s check. You can look at other packages under the vendor. Composer.json has an autoload function that automatically loads it. You can also add your corresponding ones. Reference
Seeing that you asked a question before, I don’t know if your package has been published to packagist. Of course you need to publish it, and since your first custom package introduces so many dependencies, you can just write it first Get familiar with the small functions.
The composer.json in the zcbo directory needs to be configured with the corresponding autoload psr-4 or psr-1 that conforms to the specification, so that composer update will generate the namespace-> class directory mapping. You can find this mapping file in the vendor Seen under the /composer/ folder.
You can refer to other packages that have been installed for these.
In addition, according to my visual inspection, your "BAE": "src" here, src should be src/
The composer update error is because your package is in dev status, so you need to put your package under require-dev
The defined namespace is not correct