Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Method removes excluded by user fields from the body.
- *
- * @param string $key
- * @param bool $isUpdate
- * @return array
- */
- public function getBodyFor(string $key, bool $isUpdate = false): array
- {
- if ($isUpdate) {
- foreach ($this->{$key} as $column => $value) {
- $excluding = $this->config->{'updateExcluding' . ucfirst($key) . 's'};
- $excludeAll = $this->config->{'updateExcluding' . ucfirst($key) . 'sAll'};
- if (in_array($column, $excluding) || $excludeAll) {
- unset($this->{$key}[$column]);
- }
- }
- }
- return array_filter($this->{$key} ?? []);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement