Skip to content
Advertisement

Class ‘AppmodelProduct’ not found in category.blade.php

For my Laravel assignment I am working on a store, and using models to create the pages of shown products. However, the view pages gives me the error of class not found. I am a bit stumped on that to be honest. Here is the controller I use:

JavaScript

Said Model:

JavaScript

the Category model (just in case):

JavaScript

and finally, the view page:

JavaScript

The idea is to save the space and create the page of each category to show its products; I have 3 categories in total it needs to be done for.

Thank you in advance for your help! (also, I’m using Laravel 7)

Advertisement

Answer

In both of your relationships you are referencing the Model directory instead of the Models one:

JavaScript

Fix them and it should work now.

To avoid this kind of issues, given that you’re dealing with strings, why not make use of this other (better) syntax? It’s also IDE-friendly and supports refactoring:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement