mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-10 12:24:50 +00:00
Use different method for finding objects.
This commit is contained in:
@@ -44,12 +44,13 @@ class LinkTypeFormRequest extends Request
|
||||
public function rules()
|
||||
{
|
||||
// fixed
|
||||
|
||||
/** @var LinkTypeRepositoryInterface $repository */
|
||||
$repository = app(LinkTypeRepositoryInterface::class);
|
||||
$nameRule = 'required|min:1|unique:link_types,name';
|
||||
$idRule = '';
|
||||
if (null !== $repository->find($this->integer('id'))->id) {
|
||||
|
||||
// get parameter link:
|
||||
$link = $this->route()->parameter('linkType');
|
||||
|
||||
if (null !== $link) {
|
||||
$idRule = 'exists:link_types,id';
|
||||
$nameRule = 'required|min:1';
|
||||
}
|
||||
|
||||
@@ -57,8 +57,8 @@ class ReportFormRequest extends Request
|
||||
$collection = new Collection;
|
||||
if (is_array($set)) {
|
||||
foreach ($set as $accountId) {
|
||||
$account = $repository->find(intval($accountId));
|
||||
if (null !== $account->id) {
|
||||
$account = $repository->findNull(intval($accountId));
|
||||
if (null !== $account) {
|
||||
$collection->push($account);
|
||||
}
|
||||
}
|
||||
@@ -78,8 +78,8 @@ class ReportFormRequest extends Request
|
||||
$collection = new Collection;
|
||||
if (is_array($set)) {
|
||||
foreach ($set as $budgetId) {
|
||||
$budget = $repository->find(intval($budgetId));
|
||||
if (null !== $budget->id) {
|
||||
$budget = $repository->findNull(intval($budgetId));
|
||||
if (null !== $budget) {
|
||||
$collection->push($budget);
|
||||
}
|
||||
}
|
||||
@@ -99,8 +99,8 @@ class ReportFormRequest extends Request
|
||||
$collection = new Collection;
|
||||
if (is_array($set)) {
|
||||
foreach ($set as $categoryId) {
|
||||
$category = $repository->find(intval($categoryId));
|
||||
if (null !== $category->id) {
|
||||
$category = $repository->findNull(intval($categoryId));
|
||||
if (null !== $category) {
|
||||
$collection->push($category);
|
||||
}
|
||||
}
|
||||
@@ -142,8 +142,8 @@ class ReportFormRequest extends Request
|
||||
$collection = new Collection;
|
||||
if (is_array($set)) {
|
||||
foreach ($set as $accountId) {
|
||||
$account = $repository->find(intval($accountId));
|
||||
if (null !== $account->id) {
|
||||
$account = $repository->findNull(intval($accountId));
|
||||
if (null !== $account) {
|
||||
$collection->push($account);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user