- Added client_id field to StoreTenantRequest and UpdateTenantRequest for tenant management. - Updated TenantResource to include client_id in the response. - Created migration to establish clients table and link tenants to clients. - Migrated existing tenant integrations to client_integrations table. - Grouped specific tenants under a shared client (OnTicket) in a new migration. - Updated seeders to reflect new client structure and relationships. - Adjusted integration configurations to require client instead of tenant. - Added tests for client integration functionality and ensured existing tests reflect the new client structure.
36 lines
885 B
PHP
36 lines
885 B
PHP
<?php
|
|
|
|
namespace App\Domains\Integration\Models;
|
|
|
|
use App\Domains\Client\Models\Client;
|
|
use App\Domains\Integration\Casts\EncryptedIntegrationData;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class ClientIntegration extends Model
|
|
{
|
|
protected $hidden = ['integration_data'];
|
|
|
|
protected $fillable = [
|
|
'client_id',
|
|
'integration_code',
|
|
'integration_data',
|
|
];
|
|
|
|
protected $casts = [
|
|
'integration_data' => EncryptedIntegrationData::class,
|
|
];
|
|
|
|
/** @return BelongsTo<Client, $this> */
|
|
public function client(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Client::class);
|
|
}
|
|
|
|
/** @return BelongsTo<Integration, $this> */
|
|
public function integration(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Integration::class, 'integration_code', 'integration_code');
|
|
}
|
|
}
|