public function postSettings()
    {
        $setting = app(Repository::class);

        if (Binput::get('remove_banner') === '1') {
            $setting->set('app_banner', null);
        }

        $parameters = Binput::all();

        if (isset($parameters['header'])) {
            if ($header = Binput::get('header', null, false, false)) {
                $setting->set('header', $header);
            } else {
                $setting->delete('header');
            }
        }

        if (isset($parameters['footer'])) {
            if ($footer = Binput::get('footer', null, false, false)) {
                $setting->set('footer', $footer);
            } else {
                $setting->delete('footer');
            }
        }

        if (isset($parameters['stylesheet'])) {
            if ($stylesheet = Binput::get('stylesheet', null, false, false)) {
                $setting->set('stylesheet', $stylesheet);
            } else {
                $setting->delete('stylesheet');
            }
        }

        if (Binput::hasFile('app_banner')) {
            $this->handleUpdateBanner($setting);
        }

        $excludedParams = [
            '_token',
            'app_banner',
            'remove_banner',
            'header',
            'footer',
            'stylesheet',
        ];

        try {
            foreach (Binput::except($excludedParams) as $settingName => $settingValue) {
                if ($settingName === 'app_analytics_pi_url') {
                    $settingValue = rtrim($settingValue, '/');
                }

                $setting->set($settingName, $settingValue);
            }
        } catch (Exception $e) {
            return Redirect::back()->withErrors(trans('dashboard.settings.edit.failure'));
        }

        if (Binput::has('app_locale')) {
            Lang::setLocale(Binput::get('app_locale'));
        }

        if (Binput::has('always_authenticate')) {
            Artisan::call('route:clear');
        }

        return Redirect::back()->withSuccess(trans('dashboard.settings.edit.success'));
    }