kennethjaysone's avatar

ReflectionException in Container.php, Class not found?

I'm not sure why i'm having this issue on Envoyer and not on my local homestead

ReflectionException in Container.php line 736:
Class App\Http\Controllers\DashboardController does not exist

My DasboardController is namespaced:


<?php namespace App\Http\Controllers;

use View;
use Mail;
use Sentinel;
use Redirect;
use Validator;
use Activation;
use Reminder;
use URL;
use Config;
use Session;

/**
 * Interfaces to access
 */

use Acme\Cars\CarInterface;
use Acme\Media\MediaInterface;


use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

/**
 * Requests
 */

use App\Http\Requests\PostACarRequest;

/**
 * Class DashBoardController
 * @package App\Http\Controllers
 */

class DashBoardController extends AuthorizedController { 

}

My composer.json is like this:

"autoload": {
    "classmap": [
        "database"
    ],
    "psr-4": {
        "App\\": "app/"
    },
    "psr-0": {
      "Acme": "app/"
    }
},
"autoload-dev": {
    "classmap": [
        "tests/TestCase.php"
    ]
},

I've followed the steps to upgrading to laravel 5.1 using this article

http://laravel.com/docs/5.1/upgrade#upgrade-5.1.0

Everything works fine on my machine It's so weird im really not sure what to do.

0 likes
4 replies
mstnorris's avatar
Level 55

@kennethjaysone Check your capitalisation!

Class App\Http\Controllers\DashboardController does not exist

Your Controller is called DashBoardController

class DashBoardController extends AuthorizedController {
    
}

Your host system (Windows or Mac) is case insensitive by default, and Homestead inherits this behaviour. Your production server on the other hand is case sensitive.

Whenever you get a ClassNotFound Exception check the following:

  1. Spelling
  2. Namespaces
  3. Capitalisation
5 likes
Martha's avatar

it worked with me after I run "composer update"

2 likes
kiiyaerick's avatar

Worked with me after running composer dump-autoload.

1 like

Please or to participate in this conversation.