【发布时间】:2014-10-03 09:51:17
【问题描述】:
所以这是我第一次使用 Laravel v4.2
很混乱,因为 error.log 信息太少了。
我想创建一个名为 Author 的新模型
这是我的 routes.php
Route::get('authors', 'AuthorsController@IndexAction');
这是我的 AuthorsControllers.php
<?php
class AuthorsController extends BaseController {
public $restful = true;
public $layout = 'layouts.default';
public function indexAction(){
return View::make('authors.index')
->with('title', 'Authors and Books')
->with('authors', Author::all())
;
}
public function getView($id){
return View::make('authors.view')
->with('title', 'Author View Page')
->with('author', Author::find($id))
;
}
}
这是我的Author.php
<?php
class Authors extends Eloquent {
}
我收到了这个错误日志
[20
14-10-03 01:37:43] production.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Class 'Author' not found' in C:\xampp\htdocs\laravel-master\app\controllers\AuthorsController.php:11
Stack trace:
#0 [internal function]: Illuminate\Exception\Handler->handleShutdown()
#1 {main} [] []
我想知道问题出在哪里?因为我已经关注了所有这个链接页面 http://laravel.com/docs/4.2/quick#creating-a-view
请记住,我使用 Authors 创建了控制器,使用 Author 创建了模型。
【问题讨论】:
-
仅供参考,数据库已经创建。我有 4 条记录
标签: php debugging laravel laravel-4 routes