/** * Applies processing to a single model * * @param Model $model * @return Model */ public function process(Model $model) { $hiddenOnModel = $model->getHidden(); foreach ($this->unhidden as $unhidden) { if (($key = array_search($unhidden, $hiddenOnModel)) !== false) { unset($hiddenOnModel[$key]); } } $hiddenOnModel = array_merge($hiddenOnModel, $this->hidden); $model->setHidden($hiddenOnModel); return $model; }
/** * Set hidden fields. * * @param array $fields * * @return $this */ public function hidden(array $fields) { $this->model->setHidden($fields); return $this; }