public function search($input, $getResults = true) { $query = VocabularyHasVersion::query(); $columns = Schema::getColumnListing('vocabularyHasVersions'); $attributes = array(); foreach ($columns as $attribute) { if (isset($input[$attribute]) and !empty($input[$attribute])) { $query->where($attribute, $input[$attribute]); $attributes[$attribute] = $input[$attribute]; } else { $attributes[$attribute] = null; } } if ($getResults) { return [$query->get(), $attributes]; } else { return $query; } }
/** * @return \Illuminate\Database\Eloquent\Builder */ protected function getQuery() { return VocabularyHasVersion::query(); }