Support the ongoing development of Laravel.io →
Architecture Database
Last updated 2 years ago.
0

does the class Pages have the namespace App\Models\Pages

Namespaces are not equal to directories (structure)

Last updated 2 years ago.
0

zenry said:

does the class Pages have the namespace App\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

Last updated 2 years ago.
0

Hi, you need to add your new models folder to your composer.json file using the classmap section.

Last updated 2 years ago.
0

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

Last updated 2 years ago.
0

Namespace is not the same as your directory structure

read: http://www.sitepoint.com/php-53-namespaces-basics/

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

ntanas72 ntanas72 Joined 12 Jun 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.