Improved the config system

This commit is contained in:
Graham Campbell
2016-01-29 22:49:06 +00:00
parent 51e850ddc2
commit 1b24cdb1c5
35 changed files with 188 additions and 232 deletions

View File

@@ -11,11 +11,11 @@
namespace CachetHQ\Cachet\Http\Controllers\Dashboard;
use CachetHQ\Cachet\Facades\Setting;
use CachetHQ\Cachet\Models\User;
use Exception;
use GrahamCampbell\Binput\Facades\Binput;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Lang;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\Session;
@@ -102,7 +102,7 @@ class SettingsController extends Controller
return View::make('dashboard.settings.app-setup')
->withPageTitle(trans('dashboard.settings.app-setup.app-setup').' - '.trans('dashboard.dashboard'))
->withSubMenu($this->subMenu)
->withRawAppAbout(Setting::get('app_about'));
->withRawAppAbout(Config::get('setting.app_about'));
}
/**
@@ -197,8 +197,10 @@ class SettingsController extends Controller
{
$redirectUrl = Session::get('redirect_to', route('dashboard.settings.setup'));
$setting = app('setting');
if (Binput::get('remove_banner') === '1') {
Setting::set('app_banner', null);
$setting->set('app_banner', null);
}
if (Binput::hasFile('app_banner')) {
@@ -221,10 +223,10 @@ class SettingsController extends Controller
}
// Store the banner.
Setting::set('app_banner', base64_encode(file_get_contents($file->getRealPath())));
$setting->set('app_banner', base64_encode(file_get_contents($file->getRealPath())));
// Store the banner type.
Setting::set('app_banner_type', $file->getMimeType());
$setting->set('app_banner_type', $file->getMimeType());
}
try {
@@ -233,7 +235,7 @@ class SettingsController extends Controller
$settingValue = rtrim($settingValue, '/');
}
Setting::set($settingName, $settingValue);
$setting->set($settingName, $settingValue);
}
} catch (Exception $e) {
return Redirect::to($redirectUrl)->withErrors(trans('dashboard.settings.edit.failure'));