2015-05-30 137 views
3

我relativley新laravel,並使用這個插件已經創建了一個 '文章' 支架:腳手架與Laravel

https://github.com/JeffreyWay/Laravel-4-Generators

運行:

php artisan generate:resource article --fields="title:string, body:text" 

一切順利細末,用該表在我的數據庫中創建,相關文件出現在我的項目目錄中。但是,當我瀏覽到localhost/laravel /公/文章(我的目錄),我收到以下錯誤:

ErrorException (E_NOTICE) 
HELP 
Undefined offset: 1 
Open: C:\xampp\htdocs\laravel\vendor\laravel\framework\src\Illuminate\Routing\Router.php 
      $route = $this->current(); 

      $request = $this->getCurrentRequest(); 

      // Now we can split the controller and method out of the action string so that we 
      // can call them appropriately on the class. This controller and method are in 
      // in the [email protected] format and we need to explode them out then use them. 
      list($class, $method) = explode('@', $controller); 

      return $d->dispatch($route, $request, $class, $method); 

我試圖運行

php artisan optimize --force 

但這並沒有幫助。

有什麼建議嗎?在app/routes.php文件文件

Route::resource('articles', 'ArticlesController'); 

+0

你爲什麼會在那裏導航? –

+0

獲取我所有文章的列表 – MrD

+0

您使用的是什麼版本的Laravel?如果它是5. *那麼你必須使用這個包:https://github.com/laracasts/Laravel-5-Generators-擴展 –

回答

1

你必須爲項目添加路線是這樣的。

+0

修復它,謝謝! :) – MrD