1. Go to this page and download the library: Download mxnwire/laravel-logbarrel 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/ */
use Mxnwire\LogBarrel\Facades\LogBarrel;
class CheckoutController
{
public function store(Request $request)
{
// Don't log this request at all.
LogBarrel::disable();
// ...or force-log it even when globally off / outside the configured groups.
LogBarrel::enable();
// Attach extra context to the entry.
LogBarrel::context(['order_id' => $order->id]);
// Redact extra body keys on top of the configured list.
LogBarrel::redact('ssn'); // or ['ssn', 'card_number']
// Capture only specific fields, or drop specific ones.
LogBarrel::only('method', 'url', 'user'); // whitelist
LogBarrel::without('body'); // blacklist
// Send this request's entry to a different channel / message.
LogBarrel::channel('audit')->message('checkout_completed');
}
}