【发布时间】:2013-08-14 12:26:03
【问题描述】:
我正在尝试覆盖我的 Post 类的 save() 方法,以便我可以验证一些将保存到记录中的字段:
// User.php
<?php
class Post extends Eloquent
{
public function save()
{
// code before save
parent::save();
//code after save
}
}
当我尝试在单元测试中运行此方法时,出现以下错误:
..{"error":{"type":"ErrorException","message":"Declaration of Post::save() should be compatible with that of Illuminate\\Database\\Eloquent\\Model::save()","file":"\/var\/www\/laravel\/app\/models\/Post.php","line":4}}
【问题讨论】:
标签: php model laravel laravel-4