Files
firefly-iii/app/Api/V2/Controllers/Model/Account/ShowController.php

53 lines
1.6 KiB
PHP
Raw Normal View History

2022-06-25 14:23:52 +02:00
<?php
2022-10-16 19:22:26 +02:00
2022-06-25 14:23:52 +02:00
/*
* ShowController.php
* Copyright (c) 2022 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/>.
*/
2022-10-16 19:22:26 +02:00
declare(strict_types=1);
2022-06-25 14:23:52 +02:00
namespace FireflyIII\Api\V2\Controllers\Model\Account;
use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Models\Account;
use FireflyIII\Transformers\V2\AccountTransformer;
use Illuminate\Http\JsonResponse;
2022-07-21 16:41:28 +02:00
use Illuminate\Http\Request;
2022-06-25 14:23:52 +02:00
/**
2023-10-28 16:47:11 +02:00
* Show = show a single account.
* Index = show all accounts
2022-06-25 14:23:52 +02:00
* Class ShowController
*/
class ShowController extends Controller
{
/**
2023-02-12 06:53:36 +01:00
* TODO this endpoint is not yet reachable.
2022-06-25 14:23:52 +02:00
*/
2023-11-26 16:20:24 +01:00
public function show(Account $account): JsonResponse
2022-06-25 14:23:52 +02:00
{
2022-10-30 14:23:00 +01:00
$transformer = new AccountTransformer();
2022-07-21 16:41:28 +02:00
$transformer->setParameters($this->parameters);
2022-07-03 08:33:01 +02:00
return response()
->api($this->jsonApiObject('accounts', $account, $transformer))
->header('Content-Type', self::CONTENT_TYPE);
2022-06-25 14:23:52 +02:00
}
}