1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 23:22:52 +01:00
invoiceninja/app/controllers/QuoteApiController.php

37 lines
932 B
PHP
Raw Normal View History

2014-07-27 22:31:41 +02:00
<?php
use ninja\repositories\InvoiceRepository;
2015-01-11 13:30:08 +01:00
class QuoteApiController extends Controller
{
protected $invoiceRepo;
2014-07-27 22:31:41 +02:00
2015-01-11 13:30:08 +01:00
public function __construct(InvoiceRepository $invoiceRepo)
{
$this->invoiceRepo = $invoiceRepo;
}
2014-07-27 22:31:41 +02:00
2015-01-11 13:30:08 +01:00
public function index()
{
$invoices = Invoice::scope()->where('invoices.is_quote', '=', true)->orderBy('created_at', 'desc')->get();
$invoices = Utils::remapPublicIds($invoices->toArray());
2014-07-27 22:31:41 +02:00
2015-01-11 13:30:08 +01:00
$response = json_encode($invoices, JSON_PRETTY_PRINT);
$headers = Utils::getApiHeaders(count($invoices));
2014-07-27 22:31:41 +02:00
2015-01-11 13:30:08 +01:00
return Response::make($response, 200, $headers);
}
2014-07-27 22:31:41 +02:00
2015-01-11 13:30:08 +01:00
/*
2014-07-27 22:31:41 +02:00
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);
}
*/
}