类UsersController不存在

时间:2014-04-02 10:36:29

标签: php laravel-4

如果我转到终端并输入:php artisan routes 我收到了错误。

c:\wamp\www\re3>php artisan routes
<?

class UsersController extends BaseController {
    protected $layout = 'layouts/main';

    public function __construct() {
        $this->beforeFilter('csrf', array('on'=>'post'));
        $this->beforeFilter('auth', array('only'=>array('getDashboard')));
    }

    public function getRegister() {
        $this->layout->content = View::make('users/register');
    }

    public function getLogin() {
        $this->layout->content = View::make('users/login');
    }

    public function getLogout() {
        Auth::logout();
        return Redirect::to('users/login')->with('message', '<div class="alert a
lert-success">Your are now logged out!</div>');
    }

    public function getDashboard() {
        $this->layout->content = View::make('users/dashboard');
    }

    public function postCreate() {
        $validator = Validator::make(Input::all(), User::$rules);

        if ($validator->passes()) {
            $user = new User;
            $user->firstname = Input::get('firstname');
            $user->lastname = Input::get('lastname');
            $user->email = Input::get('email');
            $user->password = Hash::make(Input::get('password'));
            $user->save();

            return Redirect::to('users/login')->with('message', '<div class="ale
rt alert-success">Your account has been created. You may login now.</div>');
        } else {
            return Redirect::to('users/register')->with('message', '<div class="
alert alert-danger">The following errors occurred</div>')->withErrors($validator
)->withInput();
        }
    }

    public function postSignin() {
        if (Auth::attempt(array('email'=>Input::get('email'), 'password'=>Input:
:get('password')))) {
        return Redirect::to('users/dashboard')->with('message', '<div class="ale
rt alert-success">You are now logged in!</div>');
    } else {
            return Redirect::to('users/login')
            ->with('message', '<div class="alert alert-danger">Your username/pas
sword combination was incorrect.</div>')
            ->withInput();
        }
    }
}
{"error":{"type":"ReflectionException","message":"Class UsersController does not
 exist","file":"C:\\wamp\\www\\re3\\vendor\\laravel\\framework\\src\\Illuminate\
\Routing\\ControllerInspector.php","line":28}}line":28}}

现在我试图在我的ListingsController.php中添加一个index()方法,但即使我有控制器,视图和模型,我也一直不会让控制器不存在。

我的路线

Route::controller('users', 'UsersController');
Route::controller('listings', 'ListingsController');
Route::get('add', array('uses' => 'ListingsController@getAdd'));
Route::controller('/', 'HomeController');

我在这里做错了什么?

0 个答案:

没有答案