public function select($capsule = null, $limit = null, $offset = null, $columns = [])
    {
        if (is_null($capsule)) {
            $capsule = $this->_database->getCapsule()->table($this->table);
        }

        if (empty($columns)) {
            $columns = '*';
        } else {
            $cstring = '';
            foreach ($columns as $column) {
                $cstring .= "{$column}, ";
            }
            $columns = rtrim($cstring, ', ');
        }

        $sql = $capsule->select("{$columns}");
        if (!is_null($limit)) {
            $sql->limit($limit);
        }
        if (!is_null($offset)) {
            $sql->offset($offset);
        }

        return $sql;
    }
public function select($capsule = null, $limit = null, $offset = null, $columns = [])
    {
        if (is_null($capsule)) {
            $capsule = $this->_database->getCapsule()->table($this->table);
        }

        if (empty($columns)) {
            $columns = '*';
        } else {
            $cstring = '';
            foreach ($columns as $column) {
                $cstring .= "{$column}, ";
            }
            $columns = rtrim($cstring, ', ');
        }

        $sql = $capsule->select("{$columns}");
        if (!is_null($limit)) {
            $sql->limit($limit);
        }
        if (!is_null($offset)) {
            $sql->offset($offset);
        }

        return $sql;
    }
public function select ( $ capsule = null , $ limit = null , $ offset = null , $ columns = [ ] ) { if ( is_null ( $ capsule ) ) { $ capsule = $ this -> _database -> getCapsule ( ) -> table ( $ this -> table ) ; } if ( empty ( $ columns ) ) { $ columns = '*' ; } else { $ cstring = '' ; foreach ( $ columns as $ column ) { $ cstring .= "{$column}, " ; } $ columns = rtrim ( $ cstring , ', ' ) ; } $ sql = $ capsule -> select ( "{$columns}" ) ; if ( ! is_null ( $ limit ) ) { $ sql -> limit ( $ limit ) ; } if ( ! is_null ( $ offset ) ) { $ sql -> offset ( $ offset ) ; } return $ sql ; }
Selects from the database table via custom SQL command.

@param \Illuminate\Database\Query\Builder $capsule - Capsule instance
@param int                                $limit   - Selection limit
@param int                                $offset  - Selection offset
@param array                              $columns - Columns to select from

@return \Illuminate\Database\Query\Builder
Selects from the database table via custom SQL command .