如何在一对多关联保存的时候,拿到关联模型的自增 ID ?
public function honestComment()
{
return $this->hasMany('HonestComment');
} $honest = $this->find($handel);
$honest->honestComment()->save([
'create_by' => $data['create_by'],
'content' => $data['content']
]);我要拿到 honest_comment 表的新增 ID