1. Go to this page and download the library: Download netojose/laravel-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/ */
netojose / laravel-log-viewer example snippets
// config/log-viewer.php
return [
// Enable or disable the log viewer entirely
'enabled' => env('LOG_VIEWER_ENABLED', true),
// URL prefix for all routes
'prefix' => env('LOG_VIEWER_PREFIX', 'log-viewer'),
// Middleware applied to all routes (authorization middleware is appended automatically)
'middleware' => ['web'],
// Gate name used for authorization (set to null to disable)
'gate' => 'viewLogViewer',
// Extra log files to expose (storage/logs/laravel.log is always
use Illuminate\Support\Facades\Gate;
public function boot(): void
{
Gate::define('viewLogViewer', function ($user) {
return in_array($user->email, [
'[email protected]',
]);
});
}