mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Various code cleanup.
This commit is contained in:
@@ -43,14 +43,14 @@ class ExportFormRequest extends Request
|
||||
$formats = join(',', array_keys(config('firefly.export_formats')));
|
||||
|
||||
return [
|
||||
// 'export_start_range' => 'required|date|after:' . $first,
|
||||
// 'export_end_range' => 'required|date|before:' . $today,
|
||||
// 'accounts' => 'required',
|
||||
// 'job' => 'required|belongsToUser:export_jobs,key',
|
||||
// 'accounts.*' => 'required|exists:accounts,id|belongsToUser:accounts',
|
||||
// 'include_attachments' => 'in:0,1',
|
||||
// 'include_config' => 'in:0,1',
|
||||
// 'exportFormat' => 'in:' . $formats,
|
||||
'export_start_range' => 'required|date|after:' . $first,
|
||||
'export_end_range' => 'required|date|before:' . $today,
|
||||
'accounts' => 'required',
|
||||
'job' => 'required|belongsToUser:export_jobs,key',
|
||||
'accounts.*' => 'required|exists:accounts,id|belongsToUser:accounts',
|
||||
'include_attachments' => 'in:0,1',
|
||||
'include_config' => 'in:0,1',
|
||||
'exportFormat' => 'in:' . $formats,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@@ -33,53 +33,6 @@ class Request extends FormRequest
|
||||
return intval($this->input($field)) === 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $field
|
||||
*
|
||||
* @return Carbon|null
|
||||
*/
|
||||
protected function date(string $field)
|
||||
{
|
||||
return $this->get($field) ? new Carbon($this->get($field)) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $field
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
protected function float(string $field): float
|
||||
{
|
||||
return round($this->input($field), 12);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $field
|
||||
* @param string $type
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getArray(string $field, string $type): array
|
||||
{
|
||||
$original = $this->get($field);
|
||||
$return = [];
|
||||
foreach ($original as $index => $value) {
|
||||
$return[$index] = $this->$type($value);
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $field
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
protected function integer(string $field): int
|
||||
{
|
||||
return intval($this->get($field));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $field
|
||||
*
|
||||
@@ -140,4 +93,51 @@ class Request extends FormRequest
|
||||
|
||||
return trim($string);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $field
|
||||
*
|
||||
* @return Carbon|null
|
||||
*/
|
||||
protected function date(string $field)
|
||||
{
|
||||
return $this->get($field) ? new Carbon($this->get($field)) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $field
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
protected function float(string $field): float
|
||||
{
|
||||
return round($this->input($field), 12);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $field
|
||||
* @param string $type
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getArray(string $field, string $type): array
|
||||
{
|
||||
$original = $this->get($field);
|
||||
$return = [];
|
||||
foreach ($original as $index => $value) {
|
||||
$return[$index] = $this->$type($value);
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $field
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
protected function integer(string $field): int
|
||||
{
|
||||
return intval($this->get($field));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user