Code Duplication    Length = 14-14 lines in 2 locations

src/Grid.php 2 locations

@@ 340-353 (lines=14) @@
337
     *
338
     * @return Collection|static
339
     */
340
    public function visibleColumns()
341
    {
342
        $visible = array_filter(explode(',', request(Tools\ColumnSelector::SELECT_COLUMN_NAME)));
343
344
        if (empty($visible)) {
345
            return $this->columns;
346
        }
347
348
        array_push($visible, '__row_selector__', '__actions__');
349
350
        return $this->columns->filter(function (Column $column) use ($visible) {
351
            return in_array($column->getName(), $visible);
352
        });
353
    }
354
355
    /**
356
     * Get all visible column names.
@@ 360-373 (lines=14) @@
357
     *
358
     * @return array|static
359
     */
360
    public function visibleColumnNames()
361
    {
362
        $visible = array_filter(explode(',', request(Tools\ColumnSelector::SELECT_COLUMN_NAME)));
363
364
        if (empty($visible)) {
365
            return $this->columnNames;
366
        }
367
368
        array_push($visible, '__row_selector__', '__actions__');
369
370
        return collect($this->columnNames)->filter(function ($column) use ($visible) {
371
            return in_array($column, $visible);
372
        });
373
    }
374
375
    /**
376
     * Add column to grid.