<commit_before><?php namespace WebEd\Base\Providers;

use Illuminate\Http\Request;
use Illuminate\Support\ServiceProvider;
use WebEd\Base\Settings\Http\Controllers\SettingController;

class HookServiceProvider extends ServiceProvider
{
    /**
     * @var Request
     */
    protected $request;
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        app()->booted(function () {
            $this->request = request();

            $this->booted();
        });
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {

    }

    /**
     * Callback when app booted
     *
     * @return void
     */
    protected function booted()
    {
        add_filter('settings.before-edit.post', function ($data, SettingController $controller) {
            if($controller->request->get('_tab') === 'advanced') {
                $data['construction_mode'] = (int)($this->request->has('construction_mode'));
                $data['show_admin_bar'] = (int)($this->request->has('show_admin_bar'));
            }
            return $data;
        });
    }
}<commit_msg>Fix bug cannot update advanced section<commit_after><?php namespace WebEd\Base\Providers;

use Illuminate\Http\Request;
use Illuminate\Support\ServiceProvider;

class HookServiceProvider extends ServiceProvider
{
    /**
     * @var Request
     */
    protected $request;
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        app()->booted(function () {
            $this->request = request();

            $this->booted();
        });
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {

    }

    /**
     * Callback when app booted
     *
     * @return void
     */
    protected function booted()
    {
        add_filter(BASE_FILTER_BEFORE_UPDATE, function ($data, $screenName, $action) {
            if ($screenName !== WEBED_SETTINGS) {
                return $data;
            }
            if($this->request->get('_tab') === 'advanced') {
                $data['construction_mode'] = (int)($this->request->has('construction_mode'));
                $data['show_admin_bar'] = (int)($this->request->has('show_admin_bar'));
            }
            return $data;
        });
    }
}
{'fraction_non_alphanumeric': 0.1411620294599018, 'fraction_numerical': 0.0, 'mean_word_length': 1.9963235294117647, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2122544', 'n_tokens_mistral': 687, 'n_tokens_neox': 680, 'n_words': 131}