@@ 386-399 (lines=14) @@ | ||
383 | * |
|
384 | * @return Collection|static |
|
385 | */ |
|
386 | public function visibleColumns() |
|
387 | { |
|
388 | $visible = array_filter(explode(',', request(Tools\ColumnSelector::SELECT_COLUMN_NAME))); |
|
389 | ||
390 | if (empty($visible)) { |
|
391 | return $this->columns; |
|
392 | } |
|
393 | ||
394 | array_push($visible, '__row_selector__', '__actions__'); |
|
395 | ||
396 | return $this->columns->filter(function (Column $column) use ($visible) { |
|
397 | return in_array($column->getName(), $visible); |
|
398 | }); |
|
399 | } |
|
400 | ||
401 | /** |
|
402 | * Get all visible column names. |
|
@@ 406-419 (lines=14) @@ | ||
403 | * |
|
404 | * @return array|static |
|
405 | */ |
|
406 | public function visibleColumnNames() |
|
407 | { |
|
408 | $visible = array_filter(explode(',', request(Tools\ColumnSelector::SELECT_COLUMN_NAME))); |
|
409 | ||
410 | if (empty($visible)) { |
|
411 | return $this->columnNames; |
|
412 | } |
|
413 | ||
414 | array_push($visible, '__row_selector__', '__actions__'); |
|
415 | ||
416 | return collect($this->columnNames)->filter(function ($column) use ($visible) { |
|
417 | return in_array($column, $visible); |
|
418 | }); |
|
419 | } |
|
420 | ||
421 | /** |
|
422 | * Add column to grid. |