PHP code example of sinemacula / laravel-log-database

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

    

sinemacula / laravel-log-database example snippets


'database' => [
    'driver'     => 'database',
    'level'      => env('LOG_LEVEL', 'debug'),
    'days'       => env('LOG_DATABASE_DAYS', 30),
    'connection' => env('LOG_DATABASE_CONNECTION'),
],

'fallback' => [
    'driver'   => 'stack',
    'channels' => ['single'],
],

use Illuminate\Support\Facades\Log;

Log::channel('database')->info('Order shipped', ['order_id' => 42]);
Log::channel('database')->error('Payment failed', ['exception' => $throwable]);

Log::warning('Cache miss rate is high', ['rate' => 0.82]);

use Illuminate\Support\Facades\Schedule;
use SineMacula\Log\Database\Models\LogMessage;

Schedule::command('model:prune', ['--model' => LogMessage::class])->daily();
bash
php artisan vendor:publish --tag=log-database-migrations
php artisan migrate