- 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.
31 lines
733 B
PHP
31 lines
733 B
PHP
<?php
|
|
|
|
namespace App\Domains\Client\Models;
|
|
|
|
use App\Domains\Integration\Models\ClientIntegration;
|
|
use App\Domains\Tenant\Models\Tenant;
|
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
#[Fillable(['code', 'name'])]
|
|
class Client extends Model
|
|
{
|
|
public function getRouteKeyName(): string
|
|
{
|
|
return 'code';
|
|
}
|
|
|
|
/** @return HasMany<Tenant, $this> */
|
|
public function tenants(): HasMany
|
|
{
|
|
return $this->hasMany(Tenant::class);
|
|
}
|
|
|
|
/** @return HasMany<ClientIntegration, $this> */
|
|
public function integrations(): HasMany
|
|
{
|
|
return $this->hasMany(ClientIntegration::class);
|
|
}
|
|
}
|