mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Performance improvements for Client Portal
This commit is contained in:
parent
47d6715fb8
commit
8aeabb7e1f
@ -42,16 +42,15 @@ class ContactLoginController extends Controller
|
||||
|
||||
if($request->has('company_key')){
|
||||
MultiDB::findAndSetDbByCompanyKey($request->input('company_key'));
|
||||
|
||||
$company = Company::where('company_key', $request->input('company_key'))->first();
|
||||
|
||||
}
|
||||
|
||||
if (!$company && strpos($request->getHost(), 'invoicing.co') !== false) {
|
||||
if($company){
|
||||
$account = $company->account;
|
||||
}
|
||||
elseif (!$company && strpos($request->getHost(), 'invoicing.co') !== false) {
|
||||
$subdomain = explode('.', $request->getHost())[0];
|
||||
|
||||
MultiDB::findAndSetDbByDomain(['subdomain' => $subdomain]);
|
||||
|
||||
$company = Company::where('subdomain', $subdomain)->first();
|
||||
|
||||
} elseif(Ninja::isHosted()){
|
||||
|
@ -43,6 +43,7 @@ class InvoicesTable extends Component
|
||||
$local_status = [];
|
||||
|
||||
$query = Invoice::query()
|
||||
->with('client.gateway_tokens','company','client.contacts')
|
||||
->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc')
|
||||
->where('company_id', $this->company->id)
|
||||
->where('is_deleted', false);
|
||||
|
@ -38,6 +38,7 @@ class QuotesTable extends Component
|
||||
public function render()
|
||||
{
|
||||
$query = Quote::query()
|
||||
->with('client.gateway_tokens','company','client.contacts')
|
||||
->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc');
|
||||
|
||||
if (count($this->status) > 0) {
|
||||
|
@ -29,7 +29,7 @@ class CheckClientExistence
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
$multiple_contacts = ClientContact::query()
|
||||
->with('company','client')
|
||||
->with('client.gateway_tokens')
|
||||
->where('email', auth('contact')->user()->email)
|
||||
->whereNotNull('email')
|
||||
->where('email', '<>', '')
|
||||
|
@ -19,10 +19,11 @@ class ContactRegister
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
$domain_name = $request->getHost();
|
||||
|
||||
if (strpos($request->getHost(), 'invoicing.co') !== false)
|
||||
if (strpos($domain_name, 'invoicing.co') !== false)
|
||||
{
|
||||
$subdomain = explode('.', $request->getHost())[0];
|
||||
$subdomain = explode('.', $domain_name)[0];
|
||||
|
||||
$query = [
|
||||
'subdomain' => $subdomain,
|
||||
@ -86,6 +87,6 @@ class ContactRegister
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
abort(404, 'ContactRegister Middlware');
|
||||
abort(404, 'ContactRegister Middleware');
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user