PHP code example of mojtabaahn / laravel-web-logs

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

    

mojtabaahn / laravel-web-logs example snippets


use Mojtabaahn\LaravelWebLogs\Http\Middlewares\Authorize;

return [

    /*
    |--------------------------------------------------------------------------
    | Dashboard Enabled
    |--------------------------------------------------------------------------
    |
    | Here you may specify either dashboard is enabled or not
    |
    */

    'enabled' => env('WEB_LOGS_ENABLED', true),

    /*
    |--------------------------------------------------------------------------
    | Route Group Attributes
    |--------------------------------------------------------------------------
    |
    | This is the array configuring package route attributes. feel free
    | to edit route prefixes, middlewares and anything else.
    |
    | In case you want to add authorization using default auth driver,
    | uncomment web middleware.
    |
    */

    'route_group_attributes' => [
        'prefix' => env('WEB_LOGS_PATH', 'web-logs'),
        'middleware' => [
            // 'web',
            Authorize::class,
        ],
    ],

    /*
    |--------------------------------------------------------------------------
    | Chunk Size
    |--------------------------------------------------------------------------
    |
    | On each request from dashboard to it's back-end how many logs should
    | it read of specified log file. Setting this option to a big number
    | may reduce dashboard performance!
    |
    */

    'chunk_size' => env('WEB_LOGS_CHUNK_SIZE', 10),

    /*
    |--------------------------------------------------------------------------
    | Search Path
    |--------------------------------------------------------------------------
    |
    | Use this property to customize logs directory where package should
    | look for log files.
    |
    */

    'search_path' => storage_path('logs'),
];

public function boot()
{
    $this->registerPolicies();

    Gate::define('viewWebLogs', function ($user = null) {
        // return true if access to web logs is allowed
    });
}
bash
php artisan vendor:publish --tag="web-logs-assets"
bash
php artisan vendor:publish --provider="Mojtabaahn\LaravelWebLogs\Providers\LaravelWebLogsServiceProvider" --tag="config"