I updated my project from laravel 4.2 to laravel 5.0. But after I came across this error and try to solve it in the last 4 hours.
I did not encounter such an error as in version 4.2. I tried the composer dump-autoloadwithout effect.
As stated in the upgrade guide, I moved all the controllers as is and made the property namespacein app/Providers/RouteServiceProvider.phpbefore null. So, I think that all my controllers are in the global namespace, so there is no need to add a path anywhere.
Here is my composer .json:
"autoload": {
"classmap": [
"app/console/commands",
"app/Http/Controllers",
"app/models",
"database/migrations",
"database/seeds",
"tests/TestCase.php"
],
Page Controller:
<?php
class PagesController extends BaseController {
protected $layout = 'layouts.loggedout';
public function getIndex() {
$categories = Category::all();
$messages = Message::groupBy('receiver_id')
->select(['receiver_id', DB::raw("COUNT('receiver_id') AS total")])
->orderBy('total', 'DESC'.....
And here is BaseController.
<?php
class BaseController extends Controller {
protected function setupLayout(){
if(!is_null($this->layout)) {
$this->layout = View::make($this->layout);
}
}
}
In routes.php, I call the controller as follows:
Route::get('/', array('as' => 'pages.index', 'uses' => 'PagesController@getIndex'));
-, , . .