我有这个奇怪的问题,在我的一个模型中,多态关系的关系名称被大写,并且它不在任何其他模型上。罪魁祸首是Like模型。
class Like extends Model
{
public function likeable()
{
return $this->morphTo();
}
}
class Comment extends Model
{
public function commentable()
{
return $this->morphTo();
}
}
当我记录模型的值时,我得到Like的大写属性和Comment的小写。
[2016-04-12 13:24:22] local.INFO: {"user_id":1,"Likeable_type":"App\\Entities\\Post","Likeable_id":64,"updated_at":"2016-04-12 13:24:22","created_at":"2016-04-12 13:24:22","id":170}
[2016-04-12 13:24:26] local.INFO: {"user_id":1,"company_id":1,"body":"testing 123","commentable_type":"App\\Entities\\Post","commentable_id":64,"updated_at":"2016-04-12 13:24:26","created_at":"2016-04-12 13:24:26","id":4,"created_at_diff_for_humans":"1 second ago"}