public function previous($field = 'datepublish', $where = [])
    {
        list($field, $asc) = $this->app['storage']->getSortOrder($field);

        $operator = $asc ? '<' : '>';
        $order = $asc ? ' DESC' : ' ASC';
        $value = isset($this->values[$field]) ? $this->values[$field] : null;

        $params = [
            $field         => $operator . $value,
            'limit'        => 1,
            'order'        => $field . $order,
            'returnsingle' => true,
            'hydrate'      => true,
        ];

        $pager = [];
        $previous = $this->app['storage']->getContent($this->contenttype['singular_slug'], $params, $pager, $where);

        return $previous;
    }
public function previous($field = 'datepublish', $where = [])
    {
        list($field, $asc) = $this->app['storage']->getSortOrder($field);

        $operator = $asc ? '<' : '>';
        $order = $asc ? ' DESC' : ' ASC';
        $value = isset($this->values[$field]) ? $this->values[$field] : null;

        $params = [
            $field         => $operator . $value,
            'limit'        => 1,
            'order'        => $field . $order,
            'returnsingle' => true,
            'hydrate'      => true,
        ];

        $pager = [];
        $previous = $this->app['storage']->getContent($this->contenttype['singular_slug'], $params, $pager, $where);

        return $previous;
    }
public function previous ( $ field = 'datepublish' , $ where = [ ] ) { list ( $ field , $ asc ) = $ this -> app [ 'storage' ] -> getSortOrder ( $ field ) ; $ operator = $ asc ? '<' : '>' ; $ order = $ asc ? ' DESC' : ' ASC' ; $ value = isset ( $ this -> values [ $ field ] ) ? $ this -> values [ $ field ] : null ; $ params = [ $ field => $ operator . $ value , 'limit' => 1 , 'order' => $ field . $ order , 'returnsingle' => true , 'hydrate' => true , ] ; $ pager = [ ] ; $ previous = $ this -> app [ 'storage' ] -> getContent ( $ this -> contenttype [ 'singular_slug' ] , $ params , $ pager , $ where ) ; return $ previous ; }
Get the previous record. In this case 'previous' is defined as 'latest one published before
this one' by default. You can pass a parameter like 'id' or '-title' to use that as
the column to sort on.

@param string $field
@param array  $where

@return \Bolt\Legacy\Content
Get the previous record . In this case previous is defined as latest one published before this one by default . You can pass a parameter like id or - title to use that as the column to sort on .