getDefaults($document), [ 'id' => (int) $document->public_id, 'name' => $document->name, 'type' => $document->type, 'invoice_id' => isset($document->invoice->public_id) ? (int) $document->invoice->public_id : null, 'expense_id' => isset($document->expense->public_id) ? (int) $document->expense->public_id : null, ]); } }