PHP code example of jhonoryza / laravel-database-logger

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

    

jhonoryza / laravel-database-logger example snippets


    
        'stack' => [
            'driver' => 'stack',
            'channels' => ['daily', 'database'],
            'ignore_exceptions' => true,
        ],
    



use Jhonoryza\DatabaseLogger\Logging\ApiLogger;

class ServiceProvider
{
    public function boot()
    {
        ApiLogger::registerMacro();
    }
}



use Illuminate\Support\Facades\Http;

$response = Http::logRequest()
    ->withHeaders(['X-Foo' => 'Bar'])
    ->post('https://api.example.com/v1/users?id=123', [
        'name' => 'Fajar',
    ]);



use Jhonoryza\DatabaseLogger\Repositories\LogAppRepository;
use Jhonoryza\DatabaseLogger\Repositories\LogApiRepository;

LogAppRepository::getAllList(limit: 10);
LogAppRepository::getSimplePaginateList(perPage: 10);
LogAppRepository::getPaginateList(perPage: 10);
LogAppRepository::getCursorList(perPage: 10);
LogAppRepository::getDetail(id: 1);

LogApiRepository::getAllList(limit: 10);
LogApiRepository::getSimplePaginateList(perPage: 10);
LogApiRepository::getPaginateList(perPage: 10);
LogApiRepository::getCursorList(perPage: 10);
LogApiRepository::getDetail(id: 1);
bash
php artisan vendor:publish --tag laravel-database-logger