1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 07:02:34 +01:00
invoiceninja/app/controllers/PaymentApiController.php

40 lines
946 B
PHP
Raw Normal View History

2014-07-27 22:31:41 +02:00
<?php
use ninja\repositories\PaymentRepository;
use Payment;
class PaymentApiController extends Controller {
protected $paymentRepo;
public function __construct(PaymentRepository $paymentRepo)
{
$this->paymentRepo = $paymentRepo;
}
public function index()
{
if (!Utils::isPro()) {
2014-07-30 09:08:01 +02:00
return Redirect::to('/');
2014-07-27 22:31:41 +02:00
}
$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);
}
*/
}