30 lines
784 B
PHP
30 lines
784 B
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
use Temporal\Client\GRPC\ServiceClient;
|
|
use Temporal\Client\WorkflowClient;
|
|
use Temporal\Client\WorkflowClientInterface;
|
|
|
|
class TemporalServiceProvider extends ServiceProvider
|
|
{
|
|
public function register(): void
|
|
{
|
|
$this->app->singleton(WorkflowClientInterface::class, function () {
|
|
return WorkflowClient::create(
|
|
ServiceClient::create(config('temporal.address'))
|
|
);
|
|
});
|
|
|
|
$this->app->alias(WorkflowClientInterface::class, WorkflowClient::class);
|
|
}
|
|
|
|
public function boot(): void
|
|
{
|
|
$this->publishes([
|
|
__DIR__ . '/../../config/temporal.php' => config_path('temporal.php'),
|
|
], 'temporal-config');
|
|
}
|
|
}
|