commit
48d17ed098
@ -29,23 +29,23 @@ class SearchString extends Component
|
|||||||
*/
|
*/
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
$searc_string = config('search-string');
|
$search_string = config('search-string');
|
||||||
|
|
||||||
$this->filters = [];
|
$this->filters = [];
|
||||||
|
|
||||||
if (!empty($searc_string[$this->model])) {
|
if (!empty($search_string[$this->model])) {
|
||||||
$columns = $searc_string[$this->model]['columns'];
|
$columns = $search_string[$this->model]['columns'];
|
||||||
|
|
||||||
foreach ($columns as $column => $options) {
|
foreach ($columns as $column => $options) {
|
||||||
// This column skip for filter
|
// This column skip for filter
|
||||||
if (!empty($options['searchable'])) {
|
if (!empty($options['searchable'])) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_array($options)) {
|
if (!is_array($options)) {
|
||||||
$column = $options;
|
$column = $options;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->isFilter($column, $options)) {
|
if (!$this->isFilter($column, $options)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -66,7 +66,7 @@ class SearchString extends Component
|
|||||||
protected function isFilter($column, $options)
|
protected function isFilter($column, $options)
|
||||||
{
|
{
|
||||||
$filter = true;
|
$filter = true;
|
||||||
|
|
||||||
if (empty($this->getFilterUrl($column, $options)) && (!isset($options['date']) && !isset($options['boolean']))) {
|
if (empty($this->getFilterUrl($column, $options)) && (!isset($options['date']) && !isset($options['boolean']))) {
|
||||||
$filter = false;
|
$filter = false;
|
||||||
}
|
}
|
||||||
@ -100,7 +100,7 @@ class SearchString extends Component
|
|||||||
}
|
}
|
||||||
|
|
||||||
$name = trans('general.' . $column);
|
$name = trans('general.' . $column);
|
||||||
|
|
||||||
if ($name == 'general.' . $column) {
|
if ($name == 'general.' . $column) {
|
||||||
$name = trans('search_string.columns.' . $column);
|
$name = trans('search_string.columns.' . $column);
|
||||||
}
|
}
|
||||||
@ -108,7 +108,7 @@ class SearchString extends Component
|
|||||||
return $name;
|
return $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getFilterType($options)
|
protected function getFilterType($options)
|
||||||
{
|
{
|
||||||
$type = 'select';
|
$type = 'select';
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ class SearchString extends Component
|
|||||||
return $type;
|
return $type;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getFilterUrl($column, $options)
|
protected function getFilterUrl($column, $options)
|
||||||
{
|
{
|
||||||
$url = '';
|
$url = '';
|
||||||
|
|
||||||
@ -143,11 +143,11 @@ class SearchString extends Component
|
|||||||
|
|
||||||
$url .= Str::slug($module_class[1], '-') . '::';
|
$url .= Str::slug($module_class[1], '-') . '::';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strpos($column, '_id') !== false) {
|
if (strpos($column, '_id') !== false) {
|
||||||
$column = str_replace('_id', '', $column);
|
$column = str_replace('_id', '', $column);
|
||||||
}
|
}
|
||||||
|
|
||||||
$plural = Str::plural($column, 2);
|
$plural = Str::plural($column, 2);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -160,7 +160,7 @@ class SearchString extends Component
|
|||||||
return $url;
|
return $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getFilterValues($column, $options)
|
protected function getFilterValues($column, $options)
|
||||||
{
|
{
|
||||||
$values = [];
|
$values = [];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user