Boolean Templating in Laravel

The Boolean field will add a switch for a true or false values for the content authors to pick from.

Before Reading

This page assumes that you have retrieved your content and stored it in a variable named $document.

Output boolean value

Here is an example of how to retrieve the value from a Boolean field which has the API ID switch.

Copy
@php
$example = $document->data->switch
if ($example) echo 'This is printed if value is true.<br />';	
@endphp