mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-01 19:47:11 +00:00
Clean up form requests
This commit is contained in:
@@ -23,15 +23,17 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Http\Requests;
|
||||
|
||||
use FireflyIII\Models\Rule;
|
||||
use FireflyIII\Support\Request\ChecksLogin;
|
||||
use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||
use FireflyIII\Support\Request\GetRuleConfiguration;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
/**
|
||||
* Class RuleFormRequest.
|
||||
*/
|
||||
class RuleFormRequest extends LoggedInRequest
|
||||
class RuleFormRequest extends FormRequest
|
||||
{
|
||||
use ConvertsDataTypes, GetRuleConfiguration;
|
||||
use ConvertsDataTypes, GetRuleConfiguration, ChecksLogin;
|
||||
|
||||
/**
|
||||
* Get all data for controller.
|
||||
@@ -54,6 +56,48 @@ class RuleFormRequest extends LoggedInRequest
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
private function getRuleTriggerData(): array
|
||||
{
|
||||
$return = [];
|
||||
$triggerData = $this->get('triggers');
|
||||
if (is_array($triggerData)) {
|
||||
foreach ($triggerData as $trigger) {
|
||||
$stopProcessing = $trigger['stop_processing'] ?? '0';
|
||||
$return[] = [
|
||||
'type' => $trigger['type'] ?? 'invalid',
|
||||
'value' => $trigger['value'] ?? '',
|
||||
'stop_processing' => 1 === (int)$stopProcessing,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
private function getRuleActionData(): array
|
||||
{
|
||||
$return = [];
|
||||
$actionData = $this->get('actions');
|
||||
if (is_array($actionData)) {
|
||||
foreach ($actionData as $action) {
|
||||
$stopProcessing = $action['stop_processing'] ?? '0';
|
||||
$return[] = [
|
||||
'type' => $action['type'] ?? 'invalid',
|
||||
'value' => $action['value'] ?? '',
|
||||
'stop_processing' => 1 === (int)$stopProcessing,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rules for this request.
|
||||
*
|
||||
@@ -93,46 +137,4 @@ class RuleFormRequest extends LoggedInRequest
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
private function getRuleActionData(): array
|
||||
{
|
||||
$return = [];
|
||||
$actionData = $this->get('actions');
|
||||
if (is_array($actionData)) {
|
||||
foreach ($actionData as $action) {
|
||||
$stopProcessing = $action['stop_processing'] ?? '0';
|
||||
$return[] = [
|
||||
'type' => $action['type'] ?? 'invalid',
|
||||
'value' => $action['value'] ?? '',
|
||||
'stop_processing' => 1 === (int) $stopProcessing,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
private function getRuleTriggerData(): array
|
||||
{
|
||||
$return = [];
|
||||
$triggerData = $this->get('triggers');
|
||||
if (is_array($triggerData)) {
|
||||
foreach ($triggerData as $trigger) {
|
||||
$stopProcessing = $trigger['stop_processing'] ?? '0';
|
||||
$return[] = [
|
||||
'type' => $trigger['type'] ?? 'invalid',
|
||||
'value' => $trigger['value'] ?? '',
|
||||
'stop_processing' => 1 === (int) $stopProcessing,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user