This commit is contained in:
David Bomba 2022-09-14 16:29:00 +10:00
parent 60d15f5d9f
commit 8d91b7d85f
3 changed files with 12 additions and 21 deletions

View File

@ -23,12 +23,6 @@ class BankIntegration extends BaseModel
protected $dates = [ protected $dates = [
]; ];
protected $casts = [
'updated_at' => 'timestamp',
'created_at' => 'timestamp',
'deleted_at' => 'timestamp',
];
public function getEntityType() public function getEntityType()
{ {
return self::class; return self::class;

View File

@ -22,13 +22,7 @@ class BankTransaction extends BaseModel
protected $dates = [ protected $dates = [
]; ];
protected $casts = [
'updated_at' => 'timestamp',
'created_at' => 'timestamp',
'deleted_at' => 'timestamp',
];
public function getEntityType() public function getEntityType()
{ {
return self::class; return self::class;

View File

@ -67,6 +67,7 @@ class CompanyTransformer extends EntityTransformer
* @var array * @var array
*/ */
protected $availableIncludes = [ protected $availableIncludes = [
'bank_transactions',
'documents', 'documents',
'users', 'users',
'designs', 'designs',
@ -103,7 +104,6 @@ class CompanyTransformer extends EntityTransformer
'recurring_expenses', 'recurring_expenses',
'purchase_orders', 'purchase_orders',
'bank_integrations', 'bank_integrations',
'bank_transactions',
]; ];
/** /**
@ -223,6 +223,16 @@ class CompanyTransformer extends EntityTransformer
return $this->includeCollection($company->tokens, $transformer, CompanyToken::class); return $this->includeCollection($company->tokens, $transformer, CompanyToken::class);
} }
public function includeBankTransactions(Company $company)
{
$transformer = new BankTransactionTransformer($this->serializer);
nlog("GEET");
nlog($company->bank_transactions()->count());
return $this->includeCollection($company->bank_transactions, $transformer, BankTransaction::class);
}
public function includeBankIntegrations(Company $company) public function includeBankIntegrations(Company $company)
{ {
$transformer = new BankIntegrationTransformer($this->serializer); $transformer = new BankIntegrationTransformer($this->serializer);
@ -230,13 +240,6 @@ class CompanyTransformer extends EntityTransformer
return $this->includeCollection($company->bank_integrations, $transformer, BankIntegration::class); return $this->includeCollection($company->bank_integrations, $transformer, BankIntegration::class);
} }
public function includeBankTransactions(Company $company)
{
$transformer = new BankTransactionTransformer($this->serializer);
return $this->includeCollection($company->bank_transactions, $transformer, BankTransaction::class);
}
public function includeTokensHashed(Company $company) public function includeTokensHashed(Company $company)
{ {
$transformer = new CompanyTokenHashedTransformer($this->serializer); $transformer = new CompanyTokenHashedTransformer($this->serializer);