Include archived records in JSON export
This commit is contained in:
parent
dafb867dc3
commit
d3372680cf
1 changed files with 10 additions and 1 deletions
|
|
@ -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')
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue