mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Improvements for eager loading
This commit is contained in:
parent
b292a843e4
commit
25d3c8d209
@ -545,7 +545,7 @@ class CreditController extends BaseController
|
||||
}
|
||||
});
|
||||
|
||||
return $this->listResponse(Credit::withTrashed()->company()->whereIn('id', $request->ids));
|
||||
return $this->listResponse(Credit::with(['invitations','documents'])->withTrashed()->company()->whereIn('id', $request->ids));
|
||||
}
|
||||
|
||||
public function action(ActionCreditRequest $request, Credit $credit, $action)
|
||||
|
@ -30,7 +30,10 @@ class TokenAuth
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if ($request->header('X-API-TOKEN') && ($company_token = CompanyToken::with(['user', 'company'])->where('token', $request->header('X-API-TOKEN'))->first())) {
|
||||
if ($request->header('X-API-TOKEN') && ($company_token = CompanyToken::with([
|
||||
'user' => [
|
||||
'account',
|
||||
], 'company'])->where('token', $request->header('X-API-TOKEN'))->first())) {
|
||||
$user = $company_token->user;
|
||||
|
||||
$error = [
|
||||
@ -51,7 +54,6 @@ class TokenAuth
|
||||
return response()->json($error, 403);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
|
||||
| Necessary evil here: As we are authenticating on CompanyToken,
|
||||
@ -59,7 +61,6 @@ class TokenAuth
|
||||
| us to decouple a $user and their attached companies completely.
|
||||
|
|
||||
*/
|
||||
|
||||
$truth = app()->make(TruthSource::class);
|
||||
|
||||
$truth->setCompanyUser($company_token->cu);
|
||||
|
@ -347,6 +347,10 @@ class RecurringInvoice extends BaseModel
|
||||
'status',
|
||||
];
|
||||
|
||||
protected $with = [
|
||||
'client.company',
|
||||
];
|
||||
|
||||
protected $touches = [];
|
||||
|
||||
public function getEntityType()
|
||||
|
@ -90,7 +90,6 @@ class RecurringInvoiceTransformer extends EntityTransformer
|
||||
'po_number' => $invoice->po_number ?: '',
|
||||
'date' => $invoice->date ?: '',
|
||||
'last_sent_date' => $invoice->last_sent_date ?: '',
|
||||
// 'next_send_date' => $invoice->next_send_date ?: '',
|
||||
'next_send_date' => $invoice->next_send_date_client ?: '',
|
||||
'due_date' => $invoice->due_date ?: '',
|
||||
'terms' => $invoice->terms ?: '',
|
||||
|
Loading…
x
Reference in New Issue
Block a user