/**
* Get the visible model casts for the index.
*
* @param \Illuminate\Database\Eloquent\Model $model
* @return array
*/
protected function getVisibleIndexCasts(BaseModel $model)
{
if (count($model->getVisible()) > 0) {
return array_intersect_key($model->getCasts(), array_flip($model->getVisible()));
}
return array_diff_key($model->getCasts(), array_flip($model->getHidden()));
}