PHP code example of gboquizosanchez / filament-log-viewer
1. Go to this page and download the library: Download gboquizosanchez/filament-log-viewer 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/ */
gboquizosanchez / filament-log-viewer example snippets
->plugin(\Boquizo\FilamentLogViewer\FilamentLogViewerPlugin::make())
->plugins([
\Boquizo\FilamentLogViewer\FilamentLogViewerPlugin::make()
->navigationGroup('System')
->navigationSort(2)
->navigationIcon(Heroicon::OutlinedDocumentText)
->navigationLabel('Log Viewer')
->timezone('Europe/Madrid')
->authorize(fn (): bool => auth()->user()->can('view-logs')),
])
->plugins([
\Boquizo\FilamentLogViewer\FilamentLogViewerPlugin::make()
->viewInModal(),
])
->plugins([
\Boquizo\FilamentLogViewer\FilamentLogViewerPlugin::make()
->viewInModal()
->viewLog(\App\Filament\LogViewer\Pages\ViewLogDenied::class),
])
// app/Filament/Pages/CustomListLogs.php
namespace App\Filament\Pages;
use Boquizo\FilamentLogViewer\Pages\ListLogs as BaseListLogs;
use Filament\Tables\Table;
class CustomListLogs extends BaseListLogs
{
protected static ?string $navigationLabel = 'Application Logs';
protected static ?string $navigationGroup = 'Monitoring';
public function table(Table $table): Table
{
return parent::table($table)
->defaultPaginationPageOption(25)
->poll('30s');
}
}
// app/Filament/Pages/CustomViewLog.php
namespace App\Filament\Pages;
use Boquizo\FilamentLogViewer\Pages\ViewLog as BaseViewLog;
use Filament\Actions\Action;
use Filament\Support\Icons\Heroicon;
class CustomViewLog extends BaseViewLog
{
protected function getHeaderActions(): array
{
return array_merge(parent::getHeaderActions(), [
Action::make('export')
->label('Export to CSV')
->icon(Heroicon::OutlinedArrowDownTray)
->action(fn () => $this->exportToCsv()),
]);
}
private function exportToCsv(): void
{
// Custom export logic
}
}
->plugins([
\Boquizo\FilamentLogViewer\FilamentLogViewerPlugin::make()
->listLogs(\App\Filament\Pages\CustomListLogs::class)
->viewLog(\App\Filament\Pages\CustomViewLog::class)
->navigationGroup('System')
->navigationSort(2)
->navigationIcon(Heroicon::DocumentText)
->navigationLabel('System Logs')
->timezone('Pacific/Auckland')
->authorize(fn (): bool => auth()->user()->hasAnyRole(['admin', 'developer'])),
])
bash
php artisan vendor:publish --provider="Boquizo\FilamentLogViewer\FilamentLogViewerServiceProvider"
css
> @source '../../../../vendor/gboquizosanchez/filament-log-viewer/resources/views/**/*.blade.php';
>