DbQuery
in package
Permite realizar consultas a la base de datos de forma sencilla.
Tags
Table of Contents
- $fields : string
- $groupBy : string
- $having : string
- $limit : int
- $offset : int
- $orderBy : array<string|int, mixed>
- $db : DataBase
- $table : string
- $where : array<string|int, Where>
- __call() : mixed
- __construct() : mixed
- array() : array<string|int, mixed>
- avg() : float
- avgArray() : array<string|int, mixed>
- count() : int
- countArray() : array<string|int, mixed>
- delete() : bool
- first() : array<string|int, mixed>
- get() : array<string|int, mixed>
- groupBy() : self
- having() : self
- insert() : bool
- insertGetId() : int|null
- limit() : self
- max() : float
- maxArray() : array<string|int, mixed>
- min() : float
- minArray() : array<string|int, mixed>
- offset() : self
- orderBy() : self
- orderMulti() : self
- reorder() : self
- select() : self
- selectRaw() : self
- sql() : string
- sum() : float
- sumArray() : array<string|int, mixed>
- table() : self
- update() : bool
- where() : $this
- whereBetween() : self
- whereEq() : self
- whereGt() : self
- whereGte() : self
- whereIn() : self
- whereLike() : self
- whereLt() : self
- whereLte() : self
- whereNotEq() : self
- whereNotIn() : self
- whereNotNull() : self
- whereNull() : self
- db() : DataBase
Properties
$fields
public
string
$fields
= '*'
$groupBy
public
string
$groupBy
$having
public
string
$having
$limit
public
int
$limit
= 0
$offset
public
int
$offset
= 0
$orderBy
public
array<string|int, mixed>
$orderBy
= []
$db
private
static DataBase
$db
$table
private
string
$table
$where
private
array<string|int, Where>
$where
= []
Methods
__call()
public
__call(mixed $method, mixed $parameters) : mixed
Parameters
- $method : mixed
- $parameters : mixed
Return values
mixed —__construct()
public
__construct(string $table) : mixed
Parameters
- $table : string
Return values
mixed —array()
public
array(string $key, string $value) : array<string|int, mixed>
Parameters
- $key : string
- $value : string
Return values
array<string|int, mixed> —avg()
public
avg(string $field[, int|null $decimals = null ]) : float
Parameters
- $field : string
- $decimals : int|null = null
Return values
float —avgArray()
public
avgArray(string $field, string $groupByKey) : array<string|int, mixed>
Parameters
- $field : string
- $groupByKey : string
Return values
array<string|int, mixed> —count()
public
count([string $field = '' ]) : int
Parameters
- $field : string = ''
Return values
int —countArray()
public
countArray(string $field, string $groupByKey) : array<string|int, mixed>
Parameters
- $field : string
- $groupByKey : string
Return values
array<string|int, mixed> —delete()
public
delete() : bool
Return values
bool —first()
public
first() : array<string|int, mixed>
Return values
array<string|int, mixed> —get()
public
get() : array<string|int, mixed>
Return values
array<string|int, mixed> —groupBy()
public
groupBy(string $fields) : self
Parameters
- $fields : string
Return values
self —having()
public
having(string $having) : self
Parameters
- $having : string
Return values
self —insert()
public
insert(array<string|int, mixed> $data) : bool
Parameters
- $data : array<string|int, mixed>
Return values
bool —insertGetId()
public
insertGetId(array<string|int, mixed> $data) : int|null
Parameters
- $data : array<string|int, mixed>
Return values
int|null —limit()
public
limit(int $limit) : self
Parameters
- $limit : int
Return values
self —max()
public
max(string $field[, int|null $decimals = null ]) : float
Parameters
- $field : string
- $decimals : int|null = null
Return values
float —maxArray()
public
maxArray(string $field, string $groupByKey) : array<string|int, mixed>
Parameters
- $field : string
- $groupByKey : string
Return values
array<string|int, mixed> —min()
public
min(string $field[, int|null $decimals = null ]) : float
Parameters
- $field : string
- $decimals : int|null = null
Return values
float —minArray()
public
minArray(string $field, string $groupByKey) : array<string|int, mixed>
Parameters
- $field : string
- $groupByKey : string
Return values
array<string|int, mixed> —offset()
public
offset(int $offset) : self
Parameters
- $offset : int
Return values
self —orderBy()
public
orderBy(string $field[, string $order = 'ASC' ]) : self
Parameters
- $field : string
- $order : string = 'ASC'
Return values
self —orderMulti()
public
orderMulti(array<string|int, mixed> $fields) : self
Parameters
- $fields : array<string|int, mixed>
Return values
self —reorder()
public
reorder() : self
Return values
self —select()
public
select(string $fields) : self
Parameters
- $fields : string
Return values
self —selectRaw()
public
selectRaw(string $fields) : self
Parameters
- $fields : string
Return values
self —sql()
public
sql() : string
Return values
string —sum()
public
sum(string $field[, int|null $decimals = null ]) : float
Parameters
- $field : string
- $decimals : int|null = null
Return values
float —sumArray()
public
sumArray(string $field, string $groupByKey) : array<string|int, mixed>
Parameters
- $field : string
- $groupByKey : string
Return values
array<string|int, mixed> —table()
public
static table(string $table) : self
Parameters
- $table : string
Return values
self —update()
public
update(array<string|int, mixed> $data) : bool
Parameters
- $data : array<string|int, mixed>
Return values
bool —where()
public
where(array<string|int, Where> $where) : $this
Parameters
- $where : array<string|int, Where>
Tags
Return values
$this —whereBetween()
public
whereBetween(string $field, mixed $value1, mixed $value2) : self
Parameters
- $field : string
- $value1 : mixed
- $value2 : mixed
Return values
self —whereEq()
public
whereEq(string $field, mixed $value) : self
Parameters
- $field : string
- $value : mixed
Return values
self —whereGt()
public
whereGt(string $field, mixed $value) : self
Parameters
- $field : string
- $value : mixed
Return values
self —whereGte()
public
whereGte(string $field, mixed $value) : self
Parameters
- $field : string
- $value : mixed
Return values
self —whereIn()
public
whereIn(string $field, array<string|int, mixed> $values) : self
Parameters
- $field : string
- $values : array<string|int, mixed>
Return values
self —whereLike()
public
whereLike(string $field, string $value) : self
Parameters
- $field : string
- $value : string
Return values
self —whereLt()
public
whereLt(string $field, mixed $value) : self
Parameters
- $field : string
- $value : mixed
Return values
self —whereLte()
public
whereLte(string $field, mixed $value) : self
Parameters
- $field : string
- $value : mixed
Return values
self —whereNotEq()
public
whereNotEq(string $field, mixed $value) : self
Parameters
- $field : string
- $value : mixed
Return values
self —whereNotIn()
public
whereNotIn(string $field, array<string|int, mixed> $values) : self
Parameters
- $field : string
- $values : array<string|int, mixed>
Return values
self —whereNotNull()
public
whereNotNull(string $field) : self
Parameters
- $field : string
Return values
self —whereNull()
public
whereNull(string $field) : self
Parameters
- $field : string
Return values
self —db()
private
static db() : DataBase