mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-05-04 13:16:31 +00:00
Autoformat lol
This commit is contained in:
@@ -51,13 +51,11 @@ class ConfigurationController extends Controller
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
$this->repository = app(UserRepositoryInterface::class);
|
||||
$this->middleware(function ($request, $next) {
|
||||
$this->repository = app(UserRepositoryInterface::class);
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
);
|
||||
return $next($request);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,18 +77,10 @@ class ConfigurationController extends Controller
|
||||
$staticData = $this->getStaticConfiguration();
|
||||
$return = [];
|
||||
foreach ($dynamicData as $key => $value) {
|
||||
$return[] = [
|
||||
'title' => sprintf('configuration.%s', $key),
|
||||
'value' => $value,
|
||||
'editable' => true,
|
||||
];
|
||||
$return[] = ['title' => sprintf('configuration.%s', $key), 'value' => $value, 'editable' => true];
|
||||
}
|
||||
foreach ($staticData as $key => $value) {
|
||||
$return[] = [
|
||||
'title' => $key,
|
||||
'value' => $value,
|
||||
'editable' => false,
|
||||
];
|
||||
$return[] = ['title' => $key, 'value' => $value, 'editable' => false];
|
||||
}
|
||||
|
||||
return response()->api($return);
|
||||
@@ -110,9 +100,9 @@ class ConfigurationController extends Controller
|
||||
|
||||
return [
|
||||
'is_demo_site' => $isDemoSite?->data,
|
||||
'permission_update_check' => null === $updateCheck ? null : (int)$updateCheck->data,
|
||||
'last_update_check' => null === $lastCheck ? null : (int)$lastCheck->data,
|
||||
'single_user_mode' => $singleUser?->data,
|
||||
'permission_update_check' => null === $updateCheck ? null : (int) $updateCheck->data,
|
||||
'last_update_check' => null === $lastCheck ? null : (int) $lastCheck->data,
|
||||
'single_user_mode' => $singleUser?->data
|
||||
];
|
||||
}
|
||||
|
||||
@@ -136,30 +126,18 @@ class ConfigurationController extends Controller
|
||||
$dynamic = $this->getDynamicConfiguration();
|
||||
$shortKey = str_replace('configuration.', '', $configKey);
|
||||
if (str_starts_with($configKey, 'configuration.')) {
|
||||
$data = [
|
||||
'title' => $configKey,
|
||||
'value' => $dynamic[$shortKey],
|
||||
'editable' => true,
|
||||
];
|
||||
$data = ['title' => $configKey, 'value' => $dynamic[$shortKey], 'editable' => true];
|
||||
|
||||
return response()->api(['data' => $data])->header('Content-Type', self::JSON_CONTENT_TYPE);
|
||||
}
|
||||
if (str_starts_with($configKey, 'webhook.')) {
|
||||
$data = [
|
||||
'title' => $configKey,
|
||||
'value' => $this->getWebhookConfiguration($configKey),
|
||||
'editable' => false,
|
||||
];
|
||||
$data = ['title' => $configKey, 'value' => $this->getWebhookConfiguration($configKey), 'editable' => false];
|
||||
|
||||
return response()->api(['data' => $data])->header('Content-Type', self::JSON_CONTENT_TYPE);
|
||||
}
|
||||
|
||||
// fallback
|
||||
$data = [
|
||||
'title' => $configKey,
|
||||
'value' => config($shortKey),
|
||||
'editable' => false,
|
||||
];
|
||||
$data = ['title' => $configKey, 'value' => config($shortKey), 'editable' => false];
|
||||
|
||||
return response()->api(['data' => $data])->header('Content-Type', self::JSON_CONTENT_TYPE);
|
||||
}
|
||||
@@ -175,7 +153,7 @@ class ConfigurationController extends Controller
|
||||
*/
|
||||
public function update(UpdateRequest $request, string $name): JsonResponse
|
||||
{
|
||||
$rules = ['value' => 'required'];
|
||||
$rules = ['value' => 'required'];
|
||||
if (!$this->repository->hasRole(auth()->user(), 'owner')) {
|
||||
$messages = ['value' => '200005: You need the "owner" role to do this.'];
|
||||
Validator::make([], $rules, $messages)->validate();
|
||||
@@ -187,11 +165,7 @@ class ConfigurationController extends Controller
|
||||
|
||||
// get updated config:
|
||||
$newConfig = $this->getDynamicConfiguration();
|
||||
$data = [
|
||||
'title' => $name,
|
||||
'value' => $newConfig[$shortName],
|
||||
'editable' => true,
|
||||
];
|
||||
$data = ['title' => $name, 'value' => $newConfig[$shortName], 'editable' => true];
|
||||
|
||||
return response()->api(['data' => $data])->header('Content-Type', self::CONTENT_TYPE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user