From 165a38263786ff04d5ee0f51a9c87ba3ce2251e6 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 28 Jan 2016 12:55:15 +1100 Subject: [PATCH] Restore an invoice from the API --- app/Http/Controllers/InvoiceApiController.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/Http/Controllers/InvoiceApiController.php b/app/Http/Controllers/InvoiceApiController.php index b9b97835e68b..5aa7971b1f50 100644 --- a/app/Http/Controllers/InvoiceApiController.php +++ b/app/Http/Controllers/InvoiceApiController.php @@ -316,6 +316,15 @@ class InvoiceApiController extends BaseAPIController return $this->response($data); } + else if ($request->action == ACTION_RESTORE) { + $invoice = Invoice::scope($publicId)->firstOrFail(); + $invoice = $this->invoiceRepo->restore($invoice); + + $transformer = new InvoiceTransformer(\Auth::user()->account, Input::get('serializer')); + $data = $this->createItem($invoice, $transformer, 'invoice'); + + return $this->response($data); + } $data = $request->input(); $data['public_id'] = $publicId;