Example #1
0
 /**
  * Return all the rows from the crud's table when the crud
  * is not set to use ajax requests, if a override query
  * has been set, then it will return the result of it
  *
  * @return array
  */
 protected function getDatatableNonAjaxRows()
 {
     // If crud's ajax is enabled, then return nothing
     if ($this->hasAjaxEnabled()) {
         return [];
     }
     // If a custom list query was not defined
     if (!$this->hasCustomDatatableQuery()) {
         $rows = Queries::getTableRows($this->getTable(), $this->getComputedColumns());
         // If it was
     } else {
         $rows = $this->getCustomDatatableQuery()->get();
     }
     $keys = $this->getTablePrimaryKeys();
     return DatatableBodyOptions::fill($rows, $this->getCustomDatatableColumns(), $keys);
 }
Example #2
0
 /**
  * Return the select options from a database table
  *
  * @return array
  */
 private function getTableOptions()
 {
     $rows = Queries::getTableRows($this->table, [$this->keyColumn, $this->descriptionColumn]);
     $options = collect();
     foreach ($rows as $row) {
         $options->push($this->createOption($row->{$this->keyColumn}, $row->{$this->descriptionColumn}));
     }
     return $options->toArray();
 }