CodeIgniter v4.5 API

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
template

TWhen of mixed

phpstan-param

TWhen $condition

phpstan-param

callable(self, TWhen): mixed $callback

phpstan-param

(callable(self): mixed)|null $defaultCallback

Return values
$this

whenNot()

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
Tags
template

TWhenNot of mixed

phpstan-param

TWhenNot $condition

phpstan-param

callable(self, TWhenNot): mixed $callback

phpstan-param

(callable(self): mixed)|null $defaultCallback

Return values
$this

        
On this page

Search results