mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Add bank integrations into default includes
This commit is contained in:
parent
c0cb157309
commit
3542e35da0
@ -105,6 +105,7 @@ class BaseController extends Controller
|
|||||||
'company.vendors.documents',
|
'company.vendors.documents',
|
||||||
'company.webhooks',
|
'company.webhooks',
|
||||||
'company.system_logs',
|
'company.system_logs',
|
||||||
|
'company.bank_integrations',
|
||||||
];
|
];
|
||||||
|
|
||||||
private $mini_load = [
|
private $mini_load = [
|
||||||
@ -122,6 +123,7 @@ class BaseController extends Controller
|
|||||||
'company.designs.company',
|
'company.designs.company',
|
||||||
'company.expense_categories',
|
'company.expense_categories',
|
||||||
'company.subscriptions',
|
'company.subscriptions',
|
||||||
|
'company.bank_integrations',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
@ -438,6 +440,13 @@ class BaseController extends Controller
|
|||||||
$query->where('subscriptions.user_id', $user->id);
|
$query->where('subscriptions.user_id', $user->id);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
'company.bank_integrations'=> function ($query) use ($updated_at, $user) {
|
||||||
|
$query->whereNotNull('updated_at');
|
||||||
|
|
||||||
|
if (! $user->isAdmin()) {
|
||||||
|
$query->where('bank_integrations.user_id', $user->id);
|
||||||
|
}
|
||||||
|
},
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -497,6 +506,12 @@ class BaseController extends Controller
|
|||||||
$query->where('activities.user_id', $user->id);
|
$query->where('activities.user_id', $user->id);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
'company.bank_integrations'=> function ($query) use ($created_at, $user) {
|
||||||
|
|
||||||
|
if (! $user->isAdmin()) {
|
||||||
|
$query->where('bank_integrations.user_id', $user->id);
|
||||||
|
}
|
||||||
|
},
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -741,6 +756,13 @@ class BaseController extends Controller
|
|||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
'company.bank_integrations'=> function ($query) use ($created_at, $user) {
|
||||||
|
$query->where('created_at', '>=', $created_at);
|
||||||
|
|
||||||
|
if (! $user->isAdmin()) {
|
||||||
|
$query->where('bank_integrations.user_id', $user->id);
|
||||||
|
}
|
||||||
|
},
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -176,6 +176,11 @@ class Company extends BaseModel
|
|||||||
return $this->hasMany(CompanyLedger::class);
|
return $this->hasMany(CompanyLedger::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function bank_integrations()
|
||||||
|
{
|
||||||
|
return $this->hasMany(BankIntegration::class);
|
||||||
|
}
|
||||||
|
|
||||||
public function getCompanyIdAttribute()
|
public function getCompanyIdAttribute()
|
||||||
{
|
{
|
||||||
return $this->encodePrimaryKey($this->id);
|
return $this->encodePrimaryKey($this->id);
|
||||||
|
@ -13,6 +13,7 @@ namespace App\Transformers;
|
|||||||
|
|
||||||
use App\Models\Account;
|
use App\Models\Account;
|
||||||
use App\Models\Activity;
|
use App\Models\Activity;
|
||||||
|
use App\Models\BankIntegration;
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Models\CompanyGateway;
|
use App\Models\CompanyGateway;
|
||||||
@ -40,6 +41,7 @@ use App\Models\TaskStatus;
|
|||||||
use App\Models\TaxRate;
|
use App\Models\TaxRate;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Models\Webhook;
|
use App\Models\Webhook;
|
||||||
|
use App\Transformers\BankIntegrationTransformer;
|
||||||
use App\Transformers\PurchaseOrderTransformer;
|
use App\Transformers\PurchaseOrderTransformer;
|
||||||
use App\Transformers\RecurringExpenseTransformer;
|
use App\Transformers\RecurringExpenseTransformer;
|
||||||
use App\Utils\Traits\MakesHash;
|
use App\Utils\Traits\MakesHash;
|
||||||
@ -98,6 +100,7 @@ class CompanyTransformer extends EntityTransformer
|
|||||||
'subscriptions',
|
'subscriptions',
|
||||||
'recurring_expenses',
|
'recurring_expenses',
|
||||||
'purchase_orders',
|
'purchase_orders',
|
||||||
|
'bank_integrations',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -217,6 +220,13 @@ class CompanyTransformer extends EntityTransformer
|
|||||||
return $this->includeCollection($company->tokens, $transformer, CompanyToken::class);
|
return $this->includeCollection($company->tokens, $transformer, CompanyToken::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function includeBankIntegrations(Company $company)
|
||||||
|
{
|
||||||
|
$transformer = new BankIntegrationTransformer($this->serializer);
|
||||||
|
|
||||||
|
return $this->includeCollection($company->bank_integrations, $transformer, BankIntegration::class);
|
||||||
|
}
|
||||||
|
|
||||||
public function includeTokensHashed(Company $company)
|
public function includeTokensHashed(Company $company)
|
||||||
{
|
{
|
||||||
$transformer = new CompanyTokenHashedTransformer($this->serializer);
|
$transformer = new CompanyTokenHashedTransformer($this->serializer);
|
||||||
|
@ -79,7 +79,6 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
|
|
||||||
@push('footer')
|
@push('footer')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user