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(mixed $condition, callable(self, TWhen): mixed $callback[, callable(self): mixed|null $defaultCallback = null ]) : $this
Parameters
- $condition : mixed
- $callback : callable(self, TWhen): mixed
- $defaultCallback : callable(self): mixed|null = null
Tags
Return values
$thiswhenNot()
Only runs the query when $condition evaluates to false
public
whenNot(mixed $condition, callable(self, TWhenNot): mixed $callback[, callable(self): mixed|null $defaultCallback = null ]) : $this
Parameters
- $condition : mixed
- $callback : callable(self, TWhenNot): mixed
- $defaultCallback : callable(self): mixed|null = null