Laravel 脚手架

Scaffolding with Laravel

我是 laravel 的新手,并且使用这个插件创建了一个 'article' 脚手架:

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

和运行:

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

一切正常,在我的数据库中创建了 table,相关文件出现在我的项目目录中。但是,当我导航到 localhost/laravel/public/articles(我的目录)时,出现以下错误:

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 Class@method 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

但这没有帮助。

有什么建议吗?

您必须为这样的文章添加路由:

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

在 app/routes.php 文件中。