OpenSkill\Datatable\Views\DatatableView::__construct PHP Method

__construct() public method

If no columns are given the user must provide them before building the view.
public __construct ( string | null $tableView, string | null $scriptView, Illuminate\Contracts\View\Factory $viewFactory, Illuminate\Contracts\Config\Repository $configRepository, array $columnConfiguration = [] )
$tableView string | null the name of the view that should be rendered for the table
$scriptView string | null the name of the view that should be rendered for the script
$viewFactory Illuminate\Contracts\View\Factory The factory used to render the views
$configRepository Illuminate\Contracts\Config\Repository The repository responsible for config resolution
$columnConfiguration array The columnConfiguration of the the server side if available
    public function __construct($tableView, $scriptView, Factory $viewFactory, Repository $configRepository, array $columnConfiguration = [])
    {
        $this->tableView = $tableView;
        $this->scriptView = $scriptView;
        $this->viewFactory = $viewFactory;
        $this->configRepository = $configRepository;
        foreach ($columnConfiguration as $item) {
            $this->columns[$item->getName()] = $item->getName();
        }
        // set table id
        $this->id($this->configRepository->get('datatable.defaultTableId'));
    }