1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-09 20:52:56 +01:00

Include archived records in JSON export

This commit is contained in:
Hillel Coren 2016-06-03 11:17:55 +03:00
parent dafb867dc3
commit d3372680cf

View File

@ -42,8 +42,17 @@ class ExportController extends BaseController
$manager = new Manager();
$manager->setSerializer(new ArraySerializer());
// eager load data, include archived but exclude deleted
$account = Auth::user()->account;
$account->load(['clients.contacts', 'clients.invoices.payments', 'clients.invoices.invoice_items']);
$account->load(['clients' => function($query) {
$query->withArchived()
->with(['contacts', 'invoices' => function($query) {
$query->withArchived()
->with(['invoice_items', 'payments' => function($query) {
$query->withArchived();
}]);
}]);
}]);
$resource = new Item($account, new AccountTransformer);
$data = $manager->parseIncludes('clients.invoices.payments')