Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added page for pulse integration #288

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@
'Passport' => 'integrations/passport',
'Nova' => 'integrations/nova',
'Telescope' => 'integrations/telescope',
'Pulse' => 'integrations/pulse',
'Livewire' => 'integrations/livewire',
'Orchid' => 'integrations/orchid',
'Sanctum' => 'integrations/sanctum',
Expand Down
41 changes: 41 additions & 0 deletions source/docs/v3/integrations/pulse.blade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
title: Laravel Pulse integration
extends: _layouts.documentation
section: content
---

# Laravel Pulse {#laravel-pulse}

To run Laravel Pulse in the main application, set the PULSE_DB_CONNECTION in the Pulse configuration file to point to the central database connection.

If you need to resolve the user from the tenant database, you should create a custom user resolver that implements the ResolvesUsers interface.

```php
class TenantUserResolver implements ResolvesUsers
{
public function key($user): int|string|null
{
return implode(':', [tenant()->name, $user->name]);
}

public function load(Collection $keys): self
{
return $this;
}

public function find(int|string|null $key): object
{
[$tenant, $user] = explode(':', $key);

return (object) [
'name' => $user,
'extra' => $tenant,
];
}
}
```

Next, register this resolver in the AppServiceProvider:
```php
$this->app->singleton(ResolvesUsers::class, TenantUserResolver::class);
```