变更
This commit is contained in:
@@ -50,6 +50,27 @@ class Collection extends AbstractCollection
|
||||
return $_tmp;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param array $attributes
|
||||
* @return bool
|
||||
* @throws Exception
|
||||
*/
|
||||
public function update(array $attributes): bool
|
||||
{
|
||||
$lists = [];
|
||||
$primary = $this->getModel()->getPrimary();
|
||||
$items = $this->getItems();
|
||||
if ($this->isEmpty() || !isset($items[0][$primary])) {
|
||||
return false;
|
||||
}
|
||||
foreach ($items as $item) {
|
||||
$lists[] = $item[$primary];
|
||||
}
|
||||
return $this->getModel()::query()->whereIn($primary, $lists)
|
||||
->batchUpdate($attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $field
|
||||
* @return array|null
|
||||
|
||||
+1
-1
@@ -187,7 +187,7 @@ class Columns extends Component
|
||||
*/
|
||||
#[Pure] public function isJson($format): bool
|
||||
{
|
||||
return in_array($format, ['json']);
|
||||
return $format == 'json';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user