Illuminate\Database\Query\Builder::exists PHP Method

exists() public method

Determine if any rows exist for the current query.
public exists ( ) : boolean
return boolean
    public function exists()
    {
        $sql = $this->grammar->compileExists($this);
        $results = $this->connection->select($sql, $this->getBindings(), !$this->useWritePdo);
        if (isset($results[0])) {
            $results = (array) $results[0];
            return (bool) $results['exists'];
        }
        return false;
    }

Usage Example

Example #1
0
 /**
  * Determine if any rows exist for the current query.
  *
  * @return bool 
  * @static 
  */
 public static function exists()
 {
     return \Illuminate\Database\Query\Builder::exists();
 }