2015-03-17 02:30:56 +01:00
|
|
|
<?php namespace App\Http\Controllers;
|
2015-03-16 22:45:25 +01:00
|
|
|
|
2015-03-17 02:30:56 +01:00
|
|
|
use Utils;
|
2015-04-08 20:19:58 +02:00
|
|
|
use Response;
|
|
|
|
use App\Models\Payment;
|
2015-03-24 09:21:12 +01:00
|
|
|
use App\Ninja\Repositories\PaymentRepository;
|
2015-03-16 22:45:25 +01:00
|
|
|
|
|
|
|
class PaymentApiController extends Controller
|
|
|
|
{
|
|
|
|
protected $paymentRepo;
|
|
|
|
|
|
|
|
public function __construct(PaymentRepository $paymentRepo)
|
|
|
|
{
|
|
|
|
$this->paymentRepo = $paymentRepo;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function index()
|
|
|
|
{
|
2015-07-02 22:21:29 +02:00
|
|
|
$payments = Payment::scope()->with('client', 'contact', 'invitation', 'user', 'invoice')->orderBy('created_at', 'desc')->get();
|
|
|
|
$payments = Utils::remapPublicIds($payments);
|
|
|
|
|
2015-03-16 22:45:25 +01:00
|
|
|
$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);
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
}
|