query() public static method

Begin querying the model.
public static query ( ) : Builder
return Builder
 /**
  * @param PaginationParameters $paginationParameters
  * @param FilterParameters $filterParameters
  * @param SortParameters $sortParameters
  * @param array $with
  * @return array
  */
 public function paginated(PaginationParameters $paginationParameters, FilterParameters $filterParameters = null, SortParameters $sortParameters = null, $with = [])
 {
     $query = $this->model->query();
     $query->with($with);
     if ($filterParameters) {
         $this->buildFilters($filterParameters, $query);
     }
     if ($sortParameters) {
         $this->buildSorting($sortParameters, $query);
     }
     $total = $query->count();
     $this->buildPagination($paginationParameters, $query);
     return $this->paginate($paginationParameters, $query->get(), $total);
 }
 /**
  * Give unexecuted query for current criteria
  *
  * @return EloquentBuilder
  */
 public function query()
 {
     $this->applyCriteria();
     if ($this->model instanceof Model) {
         return $this->model->query();
     }
     return clone $this->model;
 }
Example #3
0
 protected function buildChoices()
 {
     if (!$this->model) {
         return;
     }
     if (is_string($this->model)) {
         $this->model = App::make($this->model);
     }
     $q = $this->model->query();
     if ($this->callback) {
         $this->callback($q);
     }
     $key = $this->key ? $this->key : 'id';
     $field = $this->field ? $this->field : "title";
     $choices = $this->blank ? array('' => $this->blank) : array();
     $choices += $q->lists($field, $key);
     return $choices;
 }
 public function orderBy($column, $direction = 'asc')
 {
     $this->model = $this->model->query()->orderBy($column, $direction);
     return $this;
 }
Example #5
0
 /**
  * @return Builder
  */
 public static function query()
 {
     return parent::query();
 }
 /**
  * @param string $text
  *
  * @return \Illuminate\Database\Eloquent\Builder
  */
 public function query($text)
 {
     $query = $this->model->query();
     return $query;
 }
 /**
  * @return \Illuminate\Database\Query\Builder|static
  */
 protected function getDefaultQueryBuilder()
 {
     return $this->model->query()->getQuery();
 }
 /**
  * @{@inheritdoc}
  */
 public function query()
 {
     return $this->model->query();
 }
 /**
  * Return all instances of the model.
  *
  * @param array $columns
  * return \Illuminate\Database\Eloquent\Model
  */
 public function filterAll(array $filters = array(), array $columns = array('*'))
 {
     $query = $this->model->query();
     $query = $this->processFilters($query, $filters);
     return $query;
 }
Example #10
0
 /**
  * Returns number of records in the table
  *
  * @return int
  */
 public function count()
 {
     return $this->model->query()->get()->count();
 }
Example #11
0
 public function screenModel(Model $model)
 {
     $this->query = $model->query();
     return $this->start();
 }
 public function query(Model $model)
 {
     return $model->query();
 }