public function handle($name, array $params = [])
    {
        $model = $params[0];
        $form  = $params[1];
        $form->extend(function(FormGrid $grid) use($model) {
            $grid->fieldset('api_configuration', function (Fieldset $fieldset) use($model) {
                $fieldset->legend(trans('antares/api::labels.api_configuration'));
                $control = $fieldset->control('checkbox', 'enabled')
                        ->label(trans('antares/api::labels.api_enabled'))
                        ->value(1);
                $apiRole = ApiRoles::where(['role_id' => $model->id])->first();

                if (!is_null($apiRole) and $apiRole->enabled) {
                    $control->attributes(['checked' => 'checked']);
                }
            });
        });
    }
public function handle($name, array $params = [])
    {
        $model = $params[0];
        $form  = $params[1];
        $form->extend(function(FormGrid $grid) use($model) {
            $grid->fieldset('api_configuration', function (Fieldset $fieldset) use($model) {
                $fieldset->legend(trans('antares/api::labels.api_configuration'));
                $control = $fieldset->control('checkbox', 'enabled')
                        ->label(trans('antares/api::labels.api_enabled'))
                        ->value(1);
                $apiRole = ApiRoles::where(['role_id' => $model->id])->first();

                if (!is_null($apiRole) and $apiRole->enabled) {
                    $control->attributes(['checked' => 'checked']);
                }
            });
        });
    }
public function handle ( $ name , array $ params = [ ] ) { $ model = $ params [ 0 ] ; $ form = $ params [ 1 ] ; $ form -> extend ( function ( FormGrid $ grid ) use ( $ model ) { $ grid -> fieldset ( 'api_configuration' , function ( Fieldset $ fieldset ) use ( $ model ) { $ fieldset -> legend ( trans ( 'antares/api::labels.api_configuration' ) ) ; $ control = $ fieldset -> control ( 'checkbox' , 'enabled' ) -> label ( trans ( 'antares/api::labels.api_enabled' ) ) -> value ( 1 ) ; $ apiRole = ApiRoles :: where ( [ 'role_id' => $ model -> id ] ) -> first ( ) ; if ( ! is_null ( $ apiRole ) and $ apiRole -> enabled ) { $ control -> attributes ( [ 'checked' => 'checked' ] ) ; } } ) ; } ) ; }
form builder handler

@param FormBuilder $form
form builder handler