Files
firefly-iii/app/JsonApi/V2/Accounts/Capabilities/CrudAccount.php

59 lines
1.8 KiB
PHP
Raw Normal View History

2024-07-28 12:23:45 +02:00
<?php
/*
* CrudAccount.php
* Copyright (c) 2024 james@firefly-iii.org.
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*/
declare(strict_types=1);
namespace FireflyIII\JsonApi\V2\Accounts\Capabilities;
use FireflyIII\Models\Account;
2024-08-01 20:45:42 +02:00
use FireflyIII\Support\JsonApi\CollectsCustomParameters;
2024-07-28 12:23:45 +02:00
use FireflyIII\Support\JsonApi\Enrichments\AccountEnrichment;
2024-08-01 20:45:42 +02:00
use Illuminate\Support\Facades\Log;
2024-07-28 12:23:45 +02:00
use LaravelJsonApi\NonEloquent\Capabilities\CrudResource;
class CrudAccount extends CrudResource
{
2024-08-01 20:45:42 +02:00
use CollectsCustomParameters;
2024-07-28 12:23:45 +02:00
/**
* Read the supplied site.
*/
public function read(Account $account): ?Account
{
2024-08-01 20:45:42 +02:00
$otherParams = $this->getOtherParams($this->request->query->all());
Log::debug(__METHOD__);
2024-07-28 12:23:45 +02:00
// enrich the collected data
$enrichment = new AccountEnrichment();
2024-08-01 20:45:42 +02:00
// set start and date, if present.
$enrichment->setStart($otherParams['start'] ?? null);
$enrichment->setEnd($otherParams['end'] ?? null);
2024-07-28 12:23:45 +02:00
return $enrichment->enrichSingle($account);
}
2024-08-02 13:45:41 +02:00
public function create(array $validatedData): Account {
die('here we are');
}
2024-07-28 12:23:45 +02:00
}