mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 18:54:37 -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')){
|
if($request->has('company_key')){
|
||||||
MultiDB::findAndSetDbByCompanyKey($request->input('company_key'));
|
MultiDB::findAndSetDbByCompanyKey($request->input('company_key'));
|
||||||
|
|
||||||
$company = Company::where('company_key', $request->input('company_key'))->first();
|
$company = Company::where('company_key', $request->input('company_key'))->first();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if($company){
|
||||||
if (!$company && strpos($request->getHost(), 'invoicing.co') !== false) {
|
$account = $company->account;
|
||||||
|
}
|
||||||
|
elseif (!$company && strpos($request->getHost(), 'invoicing.co') !== false) {
|
||||||
$subdomain = explode('.', $request->getHost())[0];
|
$subdomain = explode('.', $request->getHost())[0];
|
||||||
|
|
||||||
MultiDB::findAndSetDbByDomain(['subdomain' => $subdomain]);
|
MultiDB::findAndSetDbByDomain(['subdomain' => $subdomain]);
|
||||||
|
|
||||||
$company = Company::where('subdomain', $subdomain)->first();
|
$company = Company::where('subdomain', $subdomain)->first();
|
||||||
|
|
||||||
} elseif(Ninja::isHosted()){
|
} elseif(Ninja::isHosted()){
|
||||||
|
@ -43,6 +43,7 @@ class InvoicesTable extends Component
|
|||||||
$local_status = [];
|
$local_status = [];
|
||||||
|
|
||||||
$query = Invoice::query()
|
$query = Invoice::query()
|
||||||
|
->with('client.gateway_tokens','company','client.contacts')
|
||||||
->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc')
|
->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc')
|
||||||
->where('company_id', $this->company->id)
|
->where('company_id', $this->company->id)
|
||||||
->where('is_deleted', false);
|
->where('is_deleted', false);
|
||||||
|
@ -38,6 +38,7 @@ class QuotesTable extends Component
|
|||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
$query = Quote::query()
|
$query = Quote::query()
|
||||||
|
->with('client.gateway_tokens','company','client.contacts')
|
||||||
->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc');
|
->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc');
|
||||||
|
|
||||||
if (count($this->status) > 0) {
|
if (count($this->status) > 0) {
|
||||||
|
@ -29,7 +29,7 @@ class CheckClientExistence
|
|||||||
public function handle(Request $request, Closure $next)
|
public function handle(Request $request, Closure $next)
|
||||||
{
|
{
|
||||||
$multiple_contacts = ClientContact::query()
|
$multiple_contacts = ClientContact::query()
|
||||||
->with('company','client')
|
->with('client.gateway_tokens')
|
||||||
->where('email', auth('contact')->user()->email)
|
->where('email', auth('contact')->user()->email)
|
||||||
->whereNotNull('email')
|
->whereNotNull('email')
|
||||||
->where('email', '<>', '')
|
->where('email', '<>', '')
|
||||||
|
@ -19,10 +19,11 @@ class ContactRegister
|
|||||||
*/
|
*/
|
||||||
public function handle($request, Closure $next)
|
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 = [
|
$query = [
|
||||||
'subdomain' => $subdomain,
|
'subdomain' => $subdomain,
|
||||||
@ -86,6 +87,6 @@ class ContactRegister
|
|||||||
return $next($request);
|
return $next($request);
|
||||||
}
|
}
|
||||||
|
|
||||||
abort(404, 'ContactRegister Middlware');
|
abort(404, 'ContactRegister Middleware');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user