2014-10-30 159 views
0

我的代碼有問題。我創建了一個管理員註冊,我無法使用口才來訪問我的模型。我有我的客戶用戶註冊,我遵循相同的格式,但我不能在我的管理員部分。在Laravel無法訪問雄辯模型

這裏是我的代碼:

路線

Route::model('administrator','Administrator'); 

Route::get('/flaxadmin', '[email protected]'); 
Route::get('/admin_login', '[email protected]'); 
Route::get('/admin_register', '[email protected]'); 
Route::get('/admin_dashboard', '[email protected]'); 

Route::post('/admin_handle_register', function() 
    { 

     $rules = array(
      'admin_username' => 'required|min:5|max:15', 
      'admin_lastname' => 'required|min:2|max:20', 
      'admin_firstname' => 'required|max:20', 
      'admin_password' => 'required|min:8|max:16', 
      'admin_cpassword' => 'required|same:admin_password' 
     ); 

     $validate_admin_register = Validator::make(Input::all(), $rules); 

     if($validate_admin_register->fails()) { 

      $messages = $validate_admin_register->messages(); 

      return Redirect::to('admin_register')->withErrors($messages)->withInput(Input::except('password','cpassword')); 

     } else { 

      $admin = new Administrator; 

      $admin->username = Input::get('username'); 
      $admin->lastname = Input::get('lastname'); 
      $admin->firstname = Input::get('firstname'); 
      $admin->password = Hash::make(Input::get('password')); 
      $admin->save(); 

      Session::flash('success_notification','Success: The admin account has been successfully created!'); 
      return Redirect::action('[email protected]'); 

     } 

    }); 

我的模型

<?php 

class Admninistrator extends Eloquent { 

} 

?> 

這裏是我的錯誤信息

Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_ERROR) 
Class 'Administrator' not found 

我不知道哪裏是我的錯誤。你能幫助我嗎?

回答

2

你的類名是AdmninistratorAdministrator

改變這些線

class Admninistrator extends Eloquent { 

} 

這一行

class Administrator extends Eloquent { 

} 
+0

哎喲..是這樣嗎?哈哈我很愚蠢。感謝您的迴應。 :) – Jerielle 2014-10-30 03:55:14

+0

@Jerielle親愛的你不傻。我也很愚蠢。但那是通過你的錯誤消息明顯這就是爲什麼我能夠解決它。我愚蠢如此握手會很好 – 2014-10-30 03:57:19

+0

哈哈再次感謝.. :) – Jerielle 2014-10-30 04:00:22