PHP code example of sadeim / nard-laravel

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

    

sadeim / nard-laravel example snippets


use Sadeim\Nard\Facades\Nard;

Nard::track('checkout.completed', [
    'target_type' => 'Order',
    'target_id'   => $order->id,
    'payload'     => ['total' => $order->total, 'currency' => 'USD'],
]);

Nard::activity('checkout.completed')
    ->actor($user)                       // or ->actorId('42', 'Sara')
    ->target('Order', $order->id)
    ->targetName("Order #{$order->id}")
    ->action('completed')
    ->payload(['total' => $order->total])
    ->with('currency', 'USD')
    ->record();

Nard::batch(function () {
    foreach ($invoices as $invoice) {
        $invoice->markPaid();                 // tracked automatically
        Nard::track('invoice.reconciled', ['target_id' => $invoice->id]);
    }
});
bash
php artisan vendor:publish --tag=nard-config