/**
  * 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;
 }
 /**
  * Merge rows into the form.
  *
  * @param Table $parent
  * @param Table $child
  */
 protected function mergeFields(Table $parent, Table $child)
 {
     foreach ($child->getRows() as $row) {
         $parent->addRow($row);
     }
 }
 /**
  * Get the table content.
  *
  * @return null|string
  */
 public function getTableContent()
 {
     return $this->table->getContent();
 }