/**
  * Handle the command.
  *
  * @param TablePagination $pagination
  */
 public function handle(TablePagination $pagination)
 {
     if ($this->table->getOption('enable_pagination') === false) {
         return;
     }
     $data = $this->table->getData();
     $pagination = $pagination->make($this->table);
     $data->put('pagination', $pagination);
 }
 /**
  * Return table pagination data.
  *
  * @param Table $table
  * @return array
  */
 public function make(Table $table)
 {
     $options = $table->getOptions();
     $perPage = $options->get('limit') ?: config('streams::system.per_page');
     $pageName = $table->getOption('prefix') . 'page';
     $page = app('request')->get($pageName);
     $path = '/' . app('request')->path();
     $paginator = new LengthAwarePaginator($table->getEntries(), $options->get('total_results', 0), $perPage, $page, compact('path', 'pageName'));
     $pagination = $paginator->toArray();
     $pagination['links'] = $paginator->appends(app('request')->all())->render();
     return $pagination;
 }
 /**
  * Get a table option value.
  *
  * @param        $key
  * @param  null  $default
  * @return mixed
  */
 public function getTableOption($key, $default = null)
 {
     return $this->table->getOption($key, $default);
 }