2019-09-08 12:39:13 +02:00
|
|
|
<?php
|
|
|
|
/**
|
2020-09-06 11:38:10 +02:00
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
2019-09-08 12:39:13 +02:00
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
2024-04-12 06:15:41 +02:00
|
|
|
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
|
2019-09-08 12:39:13 +02:00
|
|
|
*
|
2021-06-16 08:58:16 +02:00
|
|
|
* @license https://www.elastic.co/licensing/elastic-license
|
2019-09-08 12:39:13 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
2020-03-23 18:10:42 +01:00
|
|
|
use App\Utils\Traits\MakesDates;
|
2021-09-09 07:14:05 +02:00
|
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
2019-09-08 12:39:13 +02:00
|
|
|
|
2023-03-08 08:33:42 +01:00
|
|
|
/**
|
|
|
|
* App\Models\ClientGatewayToken
|
|
|
|
*
|
|
|
|
* @property int $id
|
|
|
|
* @property int $company_id
|
|
|
|
* @property int|null $client_id
|
|
|
|
* @property string|null $token
|
|
|
|
* @property string|null $routing_number
|
|
|
|
* @property int $company_gateway_id
|
|
|
|
* @property string|null $gateway_customer_reference
|
|
|
|
* @property int $gateway_type_id
|
2024-06-15 09:34:08 +02:00
|
|
|
* @property bool $is_default
|
2023-03-08 08:33:42 +01:00
|
|
|
* @property object|null $meta
|
|
|
|
* @property int|null $deleted_at
|
|
|
|
* @property int|null $created_at
|
|
|
|
* @property int|null $updated_at
|
2024-06-15 09:34:08 +02:00
|
|
|
* @property bool $is_deleted
|
2023-03-08 08:33:42 +01:00
|
|
|
* @property-read \App\Models\Client|null $client
|
|
|
|
* @property-read \App\Models\Company $company
|
|
|
|
* @property-read \App\Models\CompanyGateway|null $gateway
|
|
|
|
* @property-read \App\Models\GatewayType|null $gateway_type
|
|
|
|
* @property-read mixed $hashed_id
|
|
|
|
* @property-read \App\Models\User $user
|
2024-01-14 05:51:31 +01:00
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|BaseModel company()
|
2023-03-08 08:33:42 +01:00
|
|
|
* @mixin \Eloquent
|
|
|
|
*/
|
2019-09-08 12:39:13 +02:00
|
|
|
class ClientGatewayToken extends BaseModel
|
|
|
|
{
|
2020-03-23 18:10:42 +01:00
|
|
|
use MakesDates;
|
2021-09-09 07:14:05 +02:00
|
|
|
use SoftDeletes;
|
2020-03-23 18:10:42 +01:00
|
|
|
|
2019-12-30 22:59:12 +01:00
|
|
|
protected $casts = [
|
|
|
|
'meta' => 'object',
|
2019-09-26 00:27:26 +02:00
|
|
|
'updated_at' => 'timestamp',
|
|
|
|
'created_at' => 'timestamp',
|
|
|
|
'deleted_at' => 'timestamp',
|
2019-12-30 22:59:12 +01:00
|
|
|
];
|
2019-09-18 04:39:53 +02:00
|
|
|
|
2020-06-16 14:41:56 +02:00
|
|
|
protected $appends = [
|
|
|
|
'hashed_id',
|
|
|
|
];
|
2020-09-06 11:38:10 +02:00
|
|
|
|
2021-04-20 08:03:14 +02:00
|
|
|
protected $fillable = [
|
|
|
|
'token',
|
|
|
|
'routing_number',
|
|
|
|
'gateway_customer_reference',
|
|
|
|
'gateway_type_id',
|
|
|
|
'meta',
|
2021-07-01 07:56:44 +02:00
|
|
|
'client_id',
|
2021-04-20 08:03:14 +02:00
|
|
|
];
|
|
|
|
|
2020-05-06 13:49:42 +02:00
|
|
|
public function getEntityType()
|
|
|
|
{
|
2020-09-06 11:38:10 +02:00
|
|
|
return self::class;
|
2020-05-06 13:49:42 +02:00
|
|
|
}
|
|
|
|
|
2023-08-07 00:23:13 +02:00
|
|
|
public function client(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
2019-12-30 22:59:12 +01:00
|
|
|
{
|
2021-09-02 08:17:46 +02:00
|
|
|
return $this->belongsTo(Client::class)->withTrashed();
|
2019-12-30 22:59:12 +01:00
|
|
|
}
|
2019-09-08 12:39:13 +02:00
|
|
|
|
2023-08-07 00:23:13 +02:00
|
|
|
public function gateway(): \Illuminate\Database\Eloquent\Relations\HasOne
|
2019-12-30 22:59:12 +01:00
|
|
|
{
|
2020-07-08 04:20:44 +02:00
|
|
|
return $this->hasOne(CompanyGateway::class, 'id', 'company_gateway_id');
|
2019-12-30 22:59:12 +01:00
|
|
|
}
|
2019-09-08 12:39:13 +02:00
|
|
|
|
2023-08-07 00:23:13 +02:00
|
|
|
public function gateway_type(): \Illuminate\Database\Eloquent\Relations\HasOne
|
2019-12-30 22:59:12 +01:00
|
|
|
{
|
|
|
|
return $this->hasOne(GatewayType::class, 'id', 'gateway_type_id');
|
|
|
|
}
|
2019-09-18 04:39:53 +02:00
|
|
|
|
2023-09-25 12:49:48 +02:00
|
|
|
/**
|
|
|
|
* Company
|
|
|
|
*
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
|
|
*/
|
|
|
|
public function company()
|
2019-12-30 22:59:12 +01:00
|
|
|
{
|
2021-09-02 08:17:46 +02:00
|
|
|
return $this->belongsTo(Company::class);
|
2019-12-30 22:59:12 +01:00
|
|
|
}
|
2019-09-08 12:39:13 +02:00
|
|
|
|
2023-08-07 00:23:13 +02:00
|
|
|
public function user(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
2019-12-30 22:59:12 +01:00
|
|
|
{
|
2021-09-02 08:17:46 +02:00
|
|
|
return $this->belongsTo(User::class)->withTrashed();
|
2019-12-30 22:59:12 +01:00
|
|
|
}
|
|
|
|
}
|