mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-04 19:53:44 +00:00
Fix tags and rule groups.
This commit is contained in:
@@ -44,17 +44,15 @@ class UpdateRequest extends FormRequest
|
||||
*/
|
||||
public function getAll(): array
|
||||
{
|
||||
$active = true;
|
||||
|
||||
if (null !== $this->get('active')) {
|
||||
$active = $this->boolean('active');
|
||||
}
|
||||
|
||||
return [
|
||||
'title' => $this->string('title'),
|
||||
'description' => $this->string('description'),
|
||||
'active' => $active,
|
||||
// This is the way.
|
||||
$fields = [
|
||||
'title' => ['title', 'string'],
|
||||
'description' => ['description', 'nlString'],
|
||||
'active' => ['active', 'boolean'],
|
||||
'order' => ['order', 'integer'],
|
||||
];
|
||||
|
||||
return $this->getAllData($fields);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -65,8 +63,9 @@ class UpdateRequest extends FormRequest
|
||||
public function rules(): array
|
||||
{
|
||||
$ruleGroup = $this->route()->parameter('ruleGroup');
|
||||
|
||||
return [
|
||||
'title' => 'required|between:1,100|uniqueObjectForUser:rule_groups,title,' . $ruleGroup->id,
|
||||
'title' => 'between:1,100|uniqueObjectForUser:rule_groups,title,' . $ruleGroup->id,
|
||||
'description' => 'between:1,5000|nullable',
|
||||
'active' => [new IsBoolean],
|
||||
];
|
||||
|
@@ -47,13 +47,14 @@ class UpdateRequest extends FormRequest
|
||||
*/
|
||||
public function getAll(): array
|
||||
{
|
||||
$data = [
|
||||
'tag' => $this->string('tag'),
|
||||
'date' => $this->date('date'),
|
||||
'description' => $this->string('description'),
|
||||
'has_location' => true, // pretend location is present.
|
||||
// This is the way.
|
||||
$fields = [
|
||||
'tag' => ['tag', 'string'],
|
||||
'date' => ['date', 'date'],
|
||||
'description' => ['description', 'string'],
|
||||
];
|
||||
$data = $this->appendLocationData($data, null);
|
||||
$data = $this->getAllData($fields);
|
||||
$data = $this->appendLocationData($data, null);
|
||||
|
||||
return $data;
|
||||
}
|
||||
@@ -66,9 +67,9 @@ class UpdateRequest extends FormRequest
|
||||
public function rules(): array
|
||||
{
|
||||
$tag = $this->route()->parameter('tagOrId');
|
||||
|
||||
// TODO is uniqueObjectForUser not obsolete?
|
||||
$rules = [
|
||||
'tag' => 'required|min:1|uniqueObjectForUser:tags,tag,' . $tag->id,
|
||||
'tag' => 'min:1|uniqueObjectForUser:tags,tag,' . $tag->id,
|
||||
'description' => 'min:1|nullable',
|
||||
'date' => 'date|nullable',
|
||||
];
|
||||
|
Reference in New Issue
Block a user