PHP code example of microcode / filament-log-hub

1. Go to this page and download the library: Download microcode/filament-log-hub library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

microcode / filament-log-hub example snippets


use Microcode\FilamentIntegrations\IntegrationsPlugin;
use Microcode\FilamentLogHub\FilamentLogHubPlugin;

->plugin(
    IntegrationsPlugin::make()
        ->navigationGroup('Settings')
        ->only(['telegram', 'viber', 'whatsapp'])
)
->plugin(
    FilamentLogHubPlugin::make()
        ->authorize(fn (): bool => auth()->user()?->isSuperAdmin() ?? false)
        ->navigationGroup('Settings')
        ->navigationSort(40)
)

use Microcode\FilamentLogHub\Contracts\MessengerDriver;
use Microcode\FilamentLogHub\Models\LogEntry;
use Microcode\FilamentLogHub\Support\MessengerManager;

app(MessengerManager::class)->extend('discord', function (): MessengerDriver {
    return new class implements MessengerDriver {
        public function key(): string
        {
            return 'discord';
        }

        public function isConfigured(): bool
        {
            return filled(config('services.discord.webhook_url'));
        }

        public function send(LogEntry $entry): void
        {
            // send webhook...
        }
    };
});
bash
php artisan log-hub:purge
php artisan log-hub:purge --days=14