PHP code example of markrassamni / inline-boolean

1. Go to this page and download the library: Download markrassamni/inline-boolean library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

markrassamni / inline-boolean example snippets


use MarkRassamni\InlineBoolean\InlineBoolean;

class MyResource extends Resource
{
    public function fields(Request $request)
    {
        return [
            InlineBoolean::make('Enabled')
                ->inlineOnIndex()  // Use inline field on the index page
                ->inlineOnDetail()  // Use inline field on the detail page
                ->enableMessage('Boolean has been enabled.')  // Toast message when enabling boolean
                ->disableMessage('Boolean has been disabled.')  // Toast message when disabling boolean
                ->trueText('Enabled')  // Change the text describing true boolean values
                ->falseText('Disabled')  // Change the text describing false boolean values
                ->showTextOnIndex()  // Show true/false text beside the checkbox on the index page
        ];
    }
}