1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-11 21:52:35 +01:00
invoiceninja/app/controllers/PaymentApiController.php
pbergsmann 34e1d4e20d [BUGFIX] Wrong usage of use statement
Resolves errors like "The use statement
with non-compound name 'Client' has no effect"
2014-10-17 16:21:12 +02:00

40 lines
934 B
PHP

<?php
use ninja\repositories\PaymentRepository;
class PaymentApiController extends Controller {
protected $paymentRepo;
public function __construct(PaymentRepository $paymentRepo)
{
$this->paymentRepo = $paymentRepo;
}
public function index()
{
if (!Utils::isPro()) {
return Redirect::to('/');
}
$payments = Payment::scope()->orderBy('created_at', 'desc')->get();
$payments = Utils::remapPublicIds($payments->toArray());
$response = json_encode($payments, JSON_PRETTY_PRINT);
$headers = Utils::getApiHeaders(count($payments));
return Response::make($response, 200, $headers);
}
/*
public function store()
{
$data = Input::all();
$invoice = $this->invoiceRepo->save(false, $data, false);
$response = json_encode($invoice, JSON_PRETTY_PRINT);
$headers = Utils::getApiHeaders();
return Response::make($response, 200, $headers);
}
*/
}