2020-04-11 13:19:05 +02:00
|
|
|
<?php
|
|
|
|
/**
|
2020-09-06 11:38:10 +02:00
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
2020-04-11 13:19:05 +02:00
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
2023-01-28 23:21:40 +01:00
|
|
|
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
|
2020-04-11 13:19:05 +02:00
|
|
|
*
|
2021-06-16 08:58:16 +02:00
|
|
|
* @license https://www.elastic.co/licensing/elastic-license
|
2020-04-11 13:19:05 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
|
|
use App\Http\Requests\CompanyLedger\ShowCompanyLedgerRequest;
|
|
|
|
use App\Models\CompanyLedger;
|
|
|
|
use App\Transformers\CompanyLedgerTransformer;
|
2020-10-28 11:10:49 +01:00
|
|
|
use Illuminate\Http\Response;
|
2020-04-11 13:19:05 +02:00
|
|
|
|
|
|
|
class CompanyLedgerController extends BaseController
|
|
|
|
{
|
|
|
|
protected $entity_type = CompanyLedger::class;
|
|
|
|
|
|
|
|
protected $entity_transformer = CompanyLedgerTransformer::class;
|
|
|
|
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Store a newly created resource in storage.
|
|
|
|
*
|
2020-10-28 11:10:49 +01:00
|
|
|
* @param ShowCompanyLedgerRequest $request
|
|
|
|
* @return Response
|
2020-04-11 13:19:05 +02:00
|
|
|
*
|
|
|
|
* @OA\Get(
|
|
|
|
* path="/api/v1/company_ledger",
|
|
|
|
* operationId="getCompanyLedger",
|
|
|
|
* tags={"company_ledger"},
|
|
|
|
* summary="Gets a list of company_ledger",
|
|
|
|
* description="Lists the company_ledger.",
|
2023-02-10 10:21:10 +01:00
|
|
|
* @OA\Parameter(ref="#/components/parameters/X-API-TOKEN"),
|
2020-04-11 13:19:05 +02:00
|
|
|
* @OA\Parameter(ref="#/components/parameters/X-Requested-With"),
|
|
|
|
* @OA\Parameter(ref="#/components/parameters/include"),
|
|
|
|
* @OA\Response(
|
|
|
|
* response=200,
|
|
|
|
* description="A list of company_ledger",
|
2020-06-21 23:30:25 +02:00
|
|
|
* @OA\Header(header="X-MINIMUM-CLIENT-VERSION", ref="#/components/headers/X-MINIMUM-CLIENT-VERSION"),
|
2020-04-11 13:19:05 +02:00
|
|
|
* @OA\Header(header="X-RateLimit-Remaining", ref="#/components/headers/X-RateLimit-Remaining"),
|
|
|
|
* @OA\Header(header="X-RateLimit-Limit", ref="#/components/headers/X-RateLimit-Limit"),
|
|
|
|
* @OA\JsonContent(ref="#/components/schemas/CompanyLedger"),
|
|
|
|
* ),
|
|
|
|
* @OA\Response(
|
|
|
|
* response=422,
|
|
|
|
* description="Validation error",
|
|
|
|
* @OA\JsonContent(ref="#/components/schemas/ValidationError"),
|
|
|
|
* ),
|
|
|
|
* @OA\Response(
|
|
|
|
* response="default",
|
|
|
|
* description="Unexpected Error",
|
|
|
|
* @OA\JsonContent(ref="#/components/schemas/Error"),
|
|
|
|
* ),
|
|
|
|
* )
|
|
|
|
*/
|
|
|
|
public function index(ShowCompanyLedgerRequest $request)
|
|
|
|
{
|
2024-02-13 05:25:18 +01:00
|
|
|
|
2024-01-14 05:51:31 +01:00
|
|
|
/** @var \App\Models\User $user */
|
|
|
|
$user = auth()->user();
|
|
|
|
|
|
|
|
$company_ledger = CompanyLedger::where('company_id', $user->company()->id)->orderBy('id', 'ASC');
|
2020-04-11 13:19:05 +02:00
|
|
|
|
2020-04-15 02:30:52 +02:00
|
|
|
return $this->listResponse($company_ledger);
|
2020-04-11 13:19:05 +02:00
|
|
|
}
|
|
|
|
}
|