PHP code example of alfism1 / filament-log-management

1. Go to this page and download the library: Download alfism1/filament-log-management 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/ */

    

alfism1 / filament-log-management example snippets


use Alfism1\FilamentLogManagement\FilamentLogManagementPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        // ...
        ->plugin(FilamentLogManagementPlugin::make());
}

FilamentLogManagementPlugin::make()
    ->navigationGroup('Developer')
    ->navigationSort(4)
    ->navigationIcon('heroicon-o-document-magnifying-glass')
    ->navigationLabel('Log Management')
    ->slug('logs')
    ->registerNavigation(fn () => app()->environment('local', 'staging'))
    ->authorize(fn () => auth()->user()->can('page_LogViewer'))
    ->usingPage(MyLogViewer::class)

Log::info('[cron] nightly quota rebuild finished', ['trips' => $count]);
Log::error('[booking] refund failed', ['booking_id' => $booking->id]);

'processes' => [

    'booking' => [
        'label' => 'Booking',
        'color' => 'primary',                  // Filament badge colour
        'icon' => 'heroicon-o-ticket',
        'aliases' => ['bookings'],             // also matched as a [tag]
        'files' => ['booking-*.log'],          // optional
        'patterns' => [
            '/\bbooking/i',                    // prose: "booking created"
            '/[a-z]Booking/',                  // identifiers: "saveBooking failed"
        ],
    ],

    // ... the shipped defaults follow
],

'authorization' => [
    'permission' => 'page_LogViewer',
],

->authorize(fn () => auth()->user()->hasRole('developer'))
bash
php artisan vendor:publish --tag=filament-log-management-config
bash
php artisan shield:generate --page=LogViewer