mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 06:24:35 -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)
|
public function action(ActionCreditRequest $request, Credit $credit, $action)
|
||||||
|
@ -30,7 +30,10 @@ class TokenAuth
|
|||||||
*/
|
*/
|
||||||
public function handle($request, Closure $next)
|
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;
|
$user = $company_token->user;
|
||||||
|
|
||||||
$error = [
|
$error = [
|
||||||
@ -51,7 +54,6 @@ class TokenAuth
|
|||||||
return response()->json($error, 403);
|
return response()->json($error, 403);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
|
||||||
| Necessary evil here: As we are authenticating on CompanyToken,
|
| 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.
|
| us to decouple a $user and their attached companies completely.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$truth = app()->make(TruthSource::class);
|
$truth = app()->make(TruthSource::class);
|
||||||
|
|
||||||
$truth->setCompanyUser($company_token->cu);
|
$truth->setCompanyUser($company_token->cu);
|
||||||
|
@ -347,6 +347,10 @@ class RecurringInvoice extends BaseModel
|
|||||||
'status',
|
'status',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
protected $with = [
|
||||||
|
'client.company',
|
||||||
|
];
|
||||||
|
|
||||||
protected $touches = [];
|
protected $touches = [];
|
||||||
|
|
||||||
public function getEntityType()
|
public function getEntityType()
|
||||||
|
@ -90,7 +90,6 @@ class RecurringInvoiceTransformer extends EntityTransformer
|
|||||||
'po_number' => $invoice->po_number ?: '',
|
'po_number' => $invoice->po_number ?: '',
|
||||||
'date' => $invoice->date ?: '',
|
'date' => $invoice->date ?: '',
|
||||||
'last_sent_date' => $invoice->last_sent_date ?: '',
|
'last_sent_date' => $invoice->last_sent_date ?: '',
|
||||||
// 'next_send_date' => $invoice->next_send_date ?: '',
|
|
||||||
'next_send_date' => $invoice->next_send_date_client ?: '',
|
'next_send_date' => $invoice->next_send_date_client ?: '',
|
||||||
'due_date' => $invoice->due_date ?: '',
|
'due_date' => $invoice->due_date ?: '',
|
||||||
'terms' => $invoice->terms ?: '',
|
'terms' => $invoice->terms ?: '',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user