Fr3nch13/CakePHP Utilities

ToggleTrait

Toggle Trait

Common methods for toggling boolean fields in the database.

Table of Contents

Methods

boolCheck()  : Response|null
Allows toggling of boolean fields
toggle()  : Response|null
Allows toggling of boolean fields

Methods

boolCheck()

Allows toggling of boolean fields

public boolCheck(int $id, string $field[, bool|null $direct = null ]) : Response|null
Parameters
$id : int

The record id to update

$field : string

The field to toggle

$direct : bool|null = null

Check if directly set if true, if group if false, considered if null

Tags
throws
RecordNotFoundException

When record not found.

Return values
Response|null

toggle()

Allows toggling of boolean fields

public toggle(mixed $id, string $field[, null|string $action = 'index' ]) : Response|null
Parameters
$id : mixed

The record id to update

$field : string

The field to toggle

$action : null|string = 'index'

The action to send the user back to

Tags
throws
RecordNotFoundException

When record not found.

Return values
Response|null

        
On this page

Search results