feat: web, webhook and telegram channel drivers
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BCrwHHnGCB5XH968Nxokqw
This commit is contained in:
25
core/app/Channels/WebChannel.php
Normal file
25
core/app/Channels/WebChannel.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Channels;
|
||||
|
||||
use App\Enums\Presence;
|
||||
use App\Models\Delivery;
|
||||
use App\Models\Event;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
/** Инбокс. Ничего не шлёт (страница и так показывает всё), но присутствие определяет. */
|
||||
final class WebChannel implements ChannelDriver
|
||||
{
|
||||
public function presence(User $user, array $config): Presence
|
||||
{
|
||||
return Cache::has("heartbeat:{$user->id}") ? Presence::Present : Presence::Absent;
|
||||
}
|
||||
|
||||
public function deliver(Event $event, User $user, array $config, Delivery $delivery): DeliveryOutcome
|
||||
{
|
||||
return DeliveryOutcome::ok();
|
||||
}
|
||||
|
||||
public function onDone(Event $event, Delivery $delivery): void {}
|
||||
}
|
||||
Reference in New Issue
Block a user