Lazer\Classes\Core_Database::orderBy PHP Method

orderBy() public method

Sorting data by field
public orderBy ( string $key, string $direction = 'ASC' ) : Core_Database
$key string Field name
$direction string ASC|DESC
return Core_Database
    public function orderBy($key, $direction = 'ASC')
    {
        if (Helpers\Validate::table($this->name)->field($key)) {
            $directions = array('ASC' => SORT_ASC, 'DESC' => SORT_DESC);
            $this->pending[__FUNCTION__][$key] = isset($directions[$direction]) ? $directions[$direction] : 'ASC';
        }
        return $this;
    }