25 lines
583 B
PHP
25 lines
583 B
PHP
<?php
|
|
|
|
namespace App\Services;
|
|
|
|
use App\Models\IntegrationSetting;
|
|
|
|
class IntegrationSettings
|
|
{
|
|
/** @var array<string, array<string, mixed>> */
|
|
private array $resolved = [];
|
|
|
|
/** @return array<string, mixed> */
|
|
public function for(string $provider): array
|
|
{
|
|
if (! isset($this->resolved[$provider])) {
|
|
$this->resolved[$provider] = array_replace(
|
|
config('services.'.$provider, []),
|
|
IntegrationSetting::find($provider)?->settings ?? [],
|
|
);
|
|
}
|
|
|
|
return $this->resolved[$provider];
|
|
}
|
|
}
|