Reputation: 268
Route::group(array('prefix' => 'admin'), function()
{
Route::group(array('before' => 'admin-auth'), function()
{
Route::get('/add-draft', array('as' => 'admin-get-draft', 'uses' => 'Vendor\Controllers\Admin\CrawlController@viewDraft'));
Route::post('/add-draft', array('as' => 'admin-post-draft', 'uses' => 'Vendor\Controllers\Admin\CrawlController@addDraft'));
});
});
Composer
"autoload": {
"psr-0": {
"Vendor": "app"
},
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php"
]
},
CrawlController
<?php namespace Vendor\Controllers\Admin;
class CrawlController extends BaseController{
I'm getting
Symfony \ Component \ Debug \ Exception \ FatalErrorException
Class 'Vendor\Controllers\Admin\User' not found
Inside my Controller , I have a admin Folder which contains controller(CrawlController.php)
I want to be able to use ORM , which would call my Model folder which is at the same level as the controllers folder.
How can i do it properly with PSR-0? The above are my codes.
Upvotes: 1
Views: 946
Reputation: 6096
Your controller is loading properly, but it's looking for a User class inside the same namespace. Chances are you're trying to load your user model in your controller. You have to either declare the user model using a USE statement after your namespace declaration, or prefix your classes with a "\" like "\User"
Upvotes: 2