refactor: code style changes

Signed-off-by: miguel456 <me@nogueira.codes>
This commit is contained in:
2023-01-15 00:04:00 +00:00
parent 25155bff2e
commit 3727c84f3e
146 changed files with 1013 additions and 1341 deletions

View File

@@ -24,20 +24,17 @@ namespace App\Http\Controllers;
use App\Exceptions\InvalidGamePreferenceException;
use App\Exceptions\OptionNotFoundException;
use App\Facades\Options;
use App\Options as Option;
use App\Services\ConfigurationService;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Log;
class OptionsController extends Controller
{
private $configurationService;
public function __construct(ConfigurationService $configurationService) {
public function __construct(ConfigurationService $configurationService)
{
$this->configurationService = $configurationService;
}
/**
@@ -56,16 +53,15 @@ class OptionsController extends Controller
'graceperiod' => Options::getOption('graceperiod'),
'pwExpiry' => Options::getOption('password_expiry'),
'requiresPMC' => Options::getOption('requireGameLicense'),
'enforce2fa' => Options::getOption('force2fa')
'enforce2fa' => Options::getOption('force2fa'),
],
'currentGame' => Options::getOption('currentGame')
'currentGame' => Options::getOption('currentGame'),
]);
}
public function saveSettings(Request $request): \Illuminate\Http\RedirectResponse
{
try {
if (Auth::user()->can('admin.settings.edit')) {
$this->configurationService->saveConfiguration($request->all());
@@ -73,13 +69,10 @@ class OptionsController extends Controller
->back()
->with('success', __('Options updated successfully!'));
}
} catch (OptionNotFoundException | \Exception $ex) {
} catch (OptionNotFoundException|\Exception $ex) {
return redirect()
->back()
->with('error', $ex->getMessage());
}
return redirect()
@@ -90,12 +83,11 @@ class OptionsController extends Controller
public function saveGameIntegration(Request $request)
{
try {
$this->configurationService->saveGameIntegration($request->gamePref);
return redirect()
->back()
->with('success', __('Game preference updated.'));
} catch (InvalidGamePreferenceException $ex) {
return redirect()
->back()