mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-10-31 10:39:01 -04:00 
			
		
		
		
	
		
			
				
	
	
		
			40 lines
		
	
	
		
			986 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			40 lines
		
	
	
		
			986 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| use ninja\repositories\InvoiceRepository;
 | |
| use Invoice;
 | |
| 
 | |
| class InvoiceApiController extends Controller {
 | |
| 
 | |
|   protected $invoiceRepo;
 | |
| 
 | |
|   public function __construct(InvoiceRepository $invoiceRepo)
 | |
|   {
 | |
|     $this->invoiceRepo = $invoiceRepo;
 | |
|   } 
 | |
| 
 | |
|   public function index()
 | |
|   {    
 | |
|     if (!Utils::isPro()) {
 | |
|       return Redirect::to('/');
 | |
|     }
 | |
|     
 | |
|     $invoices = Invoice::scope()->where('invoices.is_quote', '=', false)->orderBy('created_at', 'desc')->get();
 | |
|     $invoices = Utils::remapPublicIds($invoices->toArray());
 | |
| 
 | |
|     $response = json_encode($invoices, JSON_PRETTY_PRINT);
 | |
|     $headers = Utils::getApiHeaders(count($invoices));
 | |
|     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);
 | |
|   }
 | |
|   */
 | |
| } |