Bool

Example of of result of the Bool Component

You can use the BoolComponent if you want to allow the user to choose between two options. To check if the user has selected an option, use the following syntax:

@if ($column->bool('show_icon'))
    <i class="fas fa-check"></i>
@else

Methods:

Label

label(string $label) This method sets the title for the admin panel.

$column->bool('is_active')->label('Active');

Labels On/Off

labelsOnOff(string $on, string $off) This method sets different labels for the on and off states.

$column->bool('is_active')->labelsOnOff('This item is active', 'This item is inactive');

Help

help(string $help) This method provides a description for the admin panel.

$column->bool('is_active')->help('This item will be displayed on the homepage.');

Default

default(bool $default) This method sets the default value when the user hasn't saved any value.

$column->bool('is_active')->default(true);

Examples:

@if ($column->bool('show')->label('Show link')->help('Enable this option to display a link.')->default(true))
    <a href="#">Click here</a>
@endif

@if ($column->bool('show_icon')->labelsOnOff('Show icon', 'Hide icon'))
    <i class="fas fa-check"></i>
@endif
Let's Join the Waitlist