PHP code example of cliqthemes / log-lens

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

    

cliqthemes / log-lens example snippets


use LogLens\Laravel\LogLens;

// Require a logged-in user (blocks incognito even in local):
LogLens::auth(fn ($request) => $request->user() !== null);

// Or restrict further — a permission, a role, or an allowlist:
LogLens::auth(fn ($request) => $request->user()?->can('view-logs') ?? false);
LogLens::auth(fn ($request) => $request->user()?->hasRole('admin') ?? false);

use Illuminate\Support\Facades\Gate;

Gate::define('viewLogLens', fn ($user) => $user?->can('view-logs') ?? false);
bash
php artisan vendor:publish --tag=log-lens-assets   # publishes the built UI to public/vendor/log-lens
php artisan vendor:publish --tag=log-lens-config   # optional: config/log-lens.php