Home >Backend Development >PHP Tutorial >The laravel framework controller calls the model layer and reports an error:

The laravel framework controller calls the model layer and reports an error:

WBOY
WBOYOriginal
2016-07-06 13:51:511089browse

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 laravel framework controller calls the model layer and reports an error:

The directory structure is as follows:
The laravel framework controller calls the model layer and reports an error:

The controller code is as follows:
The laravel framework controller calls the model layer and reports an error:

The model layer code is as follows:
The laravel framework controller calls the model layer and reports an error:

Question supplement composer.json in zcbo directory
The laravel framework controller calls the model layer and reports an error:

Supplementary question:

composer update error:
The laravel framework controller calls the model layer and reports an error:

composer.json file:
The laravel framework controller calls the model layer and reports an error:

Reply content:

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 laravel framework controller calls the model layer and reports an error:

The directory structure is as follows:
The laravel framework controller calls the model layer and reports an error:

The controller code is as follows:
The laravel framework controller calls the model layer and reports an error:

The model layer code is as follows:
The laravel framework controller calls the model layer and reports an error:

Question supplement composer.json in zcbo directory
The laravel framework controller calls the model layer and reports an error:

Supplementary question:

composer update error:
The laravel framework controller calls the model layer and reports an error:

composer.json file:
The laravel framework controller calls the model layer and reports an error:

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn