Skip to content

Commit

Permalink
改进关联的withoutfield方法参数支持字符串
Browse files Browse the repository at this point in the history
  • Loading branch information
liu21st committed Jul 18, 2021
1 parent 77fce2b commit 7a6ece3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/model/Relation.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,15 @@ public function withField(array $field)
/**
* 排除关联数据的字段
* @access public
* @param array $field 关联字段限制
* @param array|string $field 关联字段限制
* @return $this
*/
public function withoutField(array $field)
public function withoutField($field)
{
if (is_string($field)) {
$field = array_map('trim', explode(',', $field));
}

$this->withoutField = $field;
return $this;
}
Expand Down

0 comments on commit 7a6ece3

Please sign in to comment.