mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Merge pull request #3097 from GeoffreyFrogeye/att_unif
API: Unified attachment_* and model_* for Attachments
This commit is contained in:
commit
0acc2c5727
@ -57,8 +57,8 @@ class AttachmentStoreRequest extends Request
|
|||||||
'filename' => $this->string('filename'),
|
'filename' => $this->string('filename'),
|
||||||
'title' => $this->string('title'),
|
'title' => $this->string('title'),
|
||||||
'notes' => $this->nlString('notes'),
|
'notes' => $this->nlString('notes'),
|
||||||
'model' => $this->string('model'),
|
'model' => $this->string('attachable_type'),
|
||||||
'model_id' => $this->integer('model_id'),
|
'model_id' => $this->integer('attachable_id'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,14 +77,14 @@ class AttachmentStoreRequest extends Request
|
|||||||
str_replace('FireflyIII\\Models\\', '', TransactionJournal::class),
|
str_replace('FireflyIII\\Models\\', '', TransactionJournal::class),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
$model = $this->string('model');
|
$model = $this->string('attachable_type');
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'filename' => 'required|between:1,255',
|
'filename' => 'required|between:1,255',
|
||||||
'title' => 'between:1,255',
|
'title' => 'between:1,255',
|
||||||
'notes' => 'between:1,65000',
|
'notes' => 'between:1,65000',
|
||||||
'model' => sprintf('required|in:%s', $models),
|
'attachable_type' => sprintf('required|in:%s', $models),
|
||||||
'model_id' => ['required', 'numeric', new IsValidAttachmentModel($model)],
|
'attachable_id' => ['required', 'numeric', new IsValidAttachmentModel($model)],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,8 +52,8 @@ class AttachmentUpdateRequest extends Request
|
|||||||
'filename' => $this->string('filename'),
|
'filename' => $this->string('filename'),
|
||||||
'title' => $this->string('title'),
|
'title' => $this->string('title'),
|
||||||
'notes' => $this->nlString('notes'),
|
'notes' => $this->nlString('notes'),
|
||||||
'model' => $this->string('model'),
|
'model' => $this->string('attachable_type'),
|
||||||
'model_id' => $this->integer('model_id'),
|
'model_id' => $this->integer('attachable_id'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user