Performance improvements for Client Portal

This commit is contained in:
David Bomba 2021-12-07 22:34:50 +11:00
parent 47d6715fb8
commit 8aeabb7e1f
5 changed files with 11 additions and 9 deletions

View File

@ -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()){

View File

@ -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);

View File

@ -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) {

View File

@ -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', '<>', '')

View File

@ -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');
}
}