Php Laravel 4.2连接到雄辩的第一个模型
这是我第一次使用Laravel v4.2 因为error.log信息非常小,所以非常混乱 我想创建名为Author的新模型 这是我的routes.phpPhp Laravel 4.2连接到雄辩的第一个模型,php,debugging,laravel,laravel-4,routes,Php,Debugging,Laravel,Laravel 4,Routes,这是我第一次使用Laravel v4.2 因为error.log信息非常小,所以非常混乱 我想创建名为Author的新模型 这是我的routes.php Route::get('authors', 'AuthorsController@IndexAction'); <?php class AuthorsController extends BaseController { public $restful = true; public $layout = 'layout
Route::get('authors', 'AuthorsController@IndexAction');
<?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))
;
}
}
<?php
class Authors extends Eloquent {
}
这是我的AuthorsControllers.php
Route::get('authors', 'AuthorsController@IndexAction');
<?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))
;
}
}
<?php
class Authors extends Eloquent {
}
我想知道问题出在哪里?因为我已经关注了这个链接页面的所有内容
请记住,我用Authors创建了控制器,用Author创建了模型。您需要更改
class Authors extends Eloquent {
到
您可能还需要在进行更改后运行
composer dump autoload
(我不记得了)FYI,数据库已经创建。我有4条记录你在你的应用程序根目录下运行它。但是首先对文件进行更改,看看它是否有效-更改后可能不需要运行composer。那么,composer dump autoload有什么用呢?composer dump autoload-o,用于生成类加载器,如果添加新类,除非您使用转储自动加载更新它,否则它不会包含在类加载器中。@RaffyCortez回答得好,请回答我关于Laravel的问题