ConditionalTrait
Table of Contents
Methods
- when() : $this
- Only runs the query when $condition evaluates to true
- whenNot() : $this
- Only runs the query when $condition evaluates to false
Methods
when()
Only runs the query when $condition evaluates to true
public
when(array<string|int, mixed>|bool|float|int|object|resource|string|null $condition, callable $callback[, callable|null $defaultCallback = null ]) : $this
Parameters
- $condition : array<string|int, mixed>|bool|float|int|object|resource|string|null
- $callback : callable
- $defaultCallback : callable|null = null
Tags
Return values
$thiswhenNot()
Only runs the query when $condition evaluates to false
public
whenNot(array<string|int, mixed>|bool|float|int|object|resource|string|null $condition, callable $callback[, callable|null $defaultCallback = null ]) : $this
Parameters
- $condition : array<string|int, mixed>|bool|float|int|object|resource|string|null
- $callback : callable
- $defaultCallback : callable|null = null