PHP code example of label84 / laravel-logviewer

1. Go to this page and download the library: Download label84/laravel-logviewer 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/ */

    

label84 / laravel-logviewer example snippets


use LogViewer;

LogViewer::setChannel(string $channel);

use LogViewer;

LogViewer::setPath(string $path);

use LogViewer;

LogViewer::setFile(string $file);

use LogViewer;

public function index(Request $request): View
{
    $items = LogViewer::logs()->paginate(50);

    return view('dashboard', compact('items'));
}

use Label84\LogViewer\Support\LogViewerLevel;
use LogViewer;

public function index(Request $request): View
{
    $items = LogViewer::logs()
        ->whereDate(today())
        ->whereMinLevel(LogViewerLevel::ERROR)
        ->paginate(50);

    return view('dashboard', compact('items'));
}

use Label84\LogViewer\Support\LogViewerLevel;
use LogViewer;

public function index(Request $request): View
{
    $items = LogViewer::logs()
        ->whereLevel(LogViewerLevel::DEBUG)
        ->whereMessage(['Foo', 'Bar'])
        ->paginate(50);

    return view('dashboard', compact('items'));
}
sh
php artisan vendor:publish --provider="Label84\LogViewer\LogViewerServiceProvider" --tag="config"
sh
php artisan vendor:publish --provider="Label84\LogViewer\LogViewerServiceProvider" --tag="views"