Illuminate\Database\Eloquent\Builder::get PHP Метод

get() публичный Метод

Execute the query as a "select" statement.
public get ( array $columns = ['*'] ) : Illuminate\Database\Eloquent\Collection | static[]
$columns array
Результат Illuminate\Database\Eloquent\Collection | static[]
    public function get($columns = ['*'])
    {
        $builder = $this->applyScopes();
        $models = $builder->getModels($columns);
        // If we actually found models we will also eager load any relationships that
        // have been specified as needing to be eager loaded, which will solve the
        // n+1 query issue for the developers to avoid running a lot of queries.
        if (count($models) > 0) {
            $models = $builder->eagerLoadRelations($models);
        }
        return $builder->getModel()->newCollection($models);
    }

Usage Example

Пример #1
1
 /**
  * Get records from the database.
  *
  * @param int $per_page
  *
  * @return Collection
  */
 public function get($per_page = 20)
 {
     $this->per_page = $per_page;
     $this->buildQuery();
     return $this->query->get();
 }
All Usage Examples Of Illuminate\Database\Eloquent\Builder::get