App\services\OptionForm::handle PHP Method

handle() public method

public handle ( $callback = null )
    public function handle($callback = null)
    {
        if (Arr::get($_POST, 'option') == $this->id) {
            if (!is_null($callback)) {
                call_user_func($callback, $this);
            }
            foreach ($this->items as $item) {
                if ($item->type == "checkbox" && !isset($_POST[$item->id])) {
                    // preset value for checkboxes which are not checked
                    $_POST[$item->id] = "0";
                }
                if (Str::is('*[*]', $item->id)) {
                    continue;
                }
                if ($_POST[$item->id] != option($item->id, null, false)) {
                    Option::set($item->id, $_POST[$item->id]);
                }
            }
            session()->flash($this->id . '.status', 'success');
        }
        return $this;
    }