@extends('layouts.dashboard') @section('title', __('Integrations')) @section('page_title', __('API Keys & Webhooks')) @section('content') @include('partials.how-it-works', ['key' => 'admin.integrations']) @if(session('plain_key'))
{{ __('Your new API key (shown once)') }}
{{ session('plain_key') }}
@endif
@include('partials.dashboard.stat-card', ['label' => __('Active API keys'), 'value' => $keys->where('status', true)->count(), 'icon' => 'bi-key', 'color' => 'primary'])
@include('partials.dashboard.stat-card', ['label' => __('Webhooks'), 'value' => $webhooks->where('status', true)->count().' / '.$webhooks->count(), 'icon' => 'bi-broadcast', 'color' => 'info'])
@include('partials.dashboard.stat-card', ['label' => __('Deliveries (recent)'), 'value' => $deliveries->count(), 'icon' => 'bi-send-check', 'color' => $deliveries->where('status', 'failed')->count() ? 'warning' : 'success', 'hint' => __(':count failed', ['count' => $deliveries->where('status', 'failed')->count()])])
{{ __('Integration directory') }}

{{ __('Every third-party connection, its live status, and where to set it up.') }}

@foreach($directory ?? [] as $app)
@if($app['status'] === true){{ __('Connected') }} @elseif($app['status'] === 'na'){{ __('Built-in') }} @else{{ __('Not set') }}@endif
{{ $app['name'] }}
{{ $app['category'] }}
{{ $app['blurb'] }}
{{ __('Set up') }}
@endforeach
{{ __('API keys') }}
@forelse($keys as $k) @empty @endforelse
{{ __('Name') }}{{ __('Key') }}{{ __('Abilities') }}{{ __('Used') }}
{{ $k->name }}@if($k->expires_at)
{{ __('expires') }} {{ $k->expires_at->format('M d, Y') }}
@endif
{{ $k->key_prefix }}… {{ in_array('*', $k->abilities ?? [], true) ? __('All') : count($k->abilities ?? []).' '.__('scopes') }} {{ number_format($k->requests) }} · {{ $k->last_used_at?->diffForHumans() ?? __('never') }}
@csrf
@csrf @method('DELETE')
{{ __('No API keys yet.') }}
{{ __('Outgoing webhooks') }}
@forelse($webhooks as $h)
{{ $h->name }} {{ $h->last_status ? status_label($h->last_status) : __('never sent') }}@if(!$h->status){{ __('disabled') }}@endif
{{ $h->url }}
@foreach($h->events as $ev){{ $ev }}@endforeach
{{ __('Secret') }}: {{ $h->secret }} · {{ $h->deliveries_count }} {{ __('deliveries') }}@if($h->failures) · {{ $h->failures }} {{ __('consecutive failures') }}@endif
@csrf
@csrf
@csrf @method('DELETE')
@empty
{{ __('No webhooks yet. Get notified in your own systems when users sign up, buy or complete courses.') }}
@endforelse
{{ __('Recent deliveries') }}
@forelse($deliveries as $d) @empty @endforelse
{{ __('When') }}{{ __('Webhook') }}{{ __('Event') }}{{ __('Status') }}{{ __('Response') }}{{ __('Time') }}
{{ $d->created_at->diffForHumans() }} {{ $d->webhook?->name ?? '—' }} {{ $d->event }} {{ status_label($d->status) }} #{{ $d->attempt }} {{ $d->response_code ?? '—' }} {{ \Illuminate\Support\Str::limit($d->response_body, 60) }} {{ $d->duration_ms !== null ? $d->duration_ms.' ms' : '' }}
@csrf
{{ __('No deliveries yet.') }}
@endsection