1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-15 23:52:33 +01:00
invoiceninja/app/Models/BankIntegration.php

108 lines
3.4 KiB
PHP
Raw Normal View History

2022-08-05 06:25:06 +02:00
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
2023-01-28 23:21:40 +01:00
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
2022-08-05 06:25:06 +02:00
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Models;
2022-08-11 06:19:35 +02:00
use Illuminate\Database\Eloquent\SoftDeletes;
2023-03-08 08:33:42 +01:00
/**
* App\Models\BankIntegration
*
* @property int $id
* @property int $account_id
* @property int $company_id
* @property int $user_id
2023-12-11 09:23:35 +01:00
* @property string $integration_type
2023-03-08 08:33:42 +01:00
* @property string $provider_name
* @property int $provider_id
* @property int $bank_account_id
* @property string|null $bank_account_name
* @property string|null $bank_account_number
* @property string|null $bank_account_status
* @property string|null $bank_account_type
2023-08-01 14:36:04 +02:00
* @property float $balance
* @property int|null $currency
2023-03-08 08:33:42 +01:00
* @property string $nickname
2023-12-11 09:23:35 +01:00
* @property string $nordigen_account_id
2023-12-11 16:13:26 +01:00
* @property string $nordigen_institution_id
2023-03-08 08:33:42 +01:00
* @property string|null $from_date
2023-08-01 14:36:04 +02:00
* @property bool $is_deleted
2023-03-08 08:33:42 +01:00
* @property int|null $created_at
* @property int|null $updated_at
* @property int|null $deleted_at
* @property bool $disabled_upstream
* @property bool $auto_sync
2023-03-08 08:33:42 +01:00
* @property-read \App\Models\Account $account
* @property-read \App\Models\Company $company
* @property-read mixed $hashed_id
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\BankTransaction> $transactions
* @property-read int|null $transactions_count
* @property-read \App\Models\User $user
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel exclude($columns)
* @method static \Database\Factories\BankIntegrationFactory factory($count = null, $state = [])
* @method static \Illuminate\Database\Eloquent\Builder|BankIntegration filter(\App\Filters\QueryFilters $filters)
* @method static \Illuminate\Database\Eloquent\Builder|BankIntegration newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|BankIntegration newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|BankIntegration onlyTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|BankIntegration query()
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel scope()
* @method static \Illuminate\Database\Eloquent\Builder|BankIntegration withTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|BankIntegration withoutTrashed()
2023-03-16 05:20:38 +01:00
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\BankTransaction> $transactions
2023-03-08 08:33:42 +01:00
* @mixin \Eloquent
*/
2022-08-05 06:25:06 +02:00
class BankIntegration extends BaseModel
{
2022-08-11 06:19:35 +02:00
use SoftDeletes;
2022-11-11 00:13:11 +01:00
use Filterable;
2023-11-30 16:00:50 +01:00
2022-08-05 06:25:06 +02:00
protected $fillable = [
2022-09-29 11:43:59 +02:00
'bank_account_name',
'provider_name',
'bank_account_number',
'bank_account_status',
'bank_account_type',
'balance',
'currency',
'from_date',
'auto_sync',
2022-08-05 06:25:06 +02:00
];
2024-01-14 05:05:00 +01:00
public const INTEGRATION_TYPE_YODLEE = 'YODLEE';
2023-11-30 16:00:50 +01:00
2024-01-14 05:05:00 +01:00
public const INTEGRATION_TYPE_NORDIGEN = 'NORDIGEN';
2023-11-30 16:00:50 +01:00
2022-08-05 06:25:06 +02:00
public function getEntityType()
{
return self::class;
}
public function company()
{
return $this->belongsTo(Company::class);
}
public function user()
{
return $this->belongsTo(User::class)->withTrashed();
}
public function account()
{
2022-09-14 10:52:17 +02:00
return $this->belongsTo(Account::class);
2022-08-05 06:25:06 +02:00
}
2022-08-12 03:40:35 +02:00
public function transactions()
{
return $this->hasMany(BankTransaction::class)->withTrashed();
}
2023-11-30 16:00:50 +01:00
}