does the class Pages
have the namespace App\Models\Pages
Namespaces are not equal to directories (structure)
zenry said:
does the class
Pages
have the namespaceApp\Models\Pages
Namespaces are not equal to directories
The Page class is inside app/models/Pages
I guess the problem is that i have mu backend controller in other namespace
I had the same problem when i created the controller but the statement use BaseController; use View;
solved my problem regarding controller and views
I tried
use Models;
but still get error Class 'Backend\Pages' not found
I am new to Laravel and i really dont know how to call my model
Thanks for your reply
Hi, you need to add your new models folder to your composer.json file using the classmap section.
I remove the use of Models and I change the call for the model calling from the global namespace
and its working now
$pages = \Pages::orderBy('id','desc')->paginate(10);
but besides that its working
is that "good laravel coding style" or i have to implement differently
Thanks
Namespace is not the same as your directory structure
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community