This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

devnull69
devnull69

tabs:
fields:
use_plugin:
label: Enable Robots Plugin?
type: switch
commentAbove: Enable/Disable Devnull.Robot Plugin

use_humans:
  label: Enable humans.txt?
  commentAbove: Enable/Disable Humans.txt Sub Module
  type: checkbox
  trigger:
    action: show
    field: use_plugin
    condition: checked

use_robots:
  label: Enable robots.txt?
  type: checkbox
  commentAbove: Enable/Disable Robots.txt Sub Module
  trigger:
    action: show
    field: use_plugin
    condition: checked

how do i make in my settings model, the following? if use_plugin = false, then use_humans AND use_robots = false if use_plugin = false, then use_humans AND use_robots = FALSE

Do i make in afterUpdate() or beforeUpdate() ?

Scott
Scott

You can use a model assessor for this

public function setUseHumansAttribute($value)
{
    $this->attributes['use_humans'] = $this->use_plugin
        ? $value
        : false;
}

public function setUseRobotsAttribute($value)
{
    $this->attributes['use_robots'] = $this->use_plugin
        ? $value
        : false;
}

Last updated

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.