PHP code example of minutemailer / laravel-honeypot

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

    

minutemailer / laravel-honeypot example snippets


use Minutemailer\Honeypot\Traits\CanHaveCredits;

class User extends Authenticatable
{
    use CanHaveCredits;
}

$user->addCreditBucket('credits', [
    'expires_at' => now()->addYear(), // Optional, defaults to null
    'valid_from' => now()->subYear(), // Optional, defaults to null
    'amount' => 1000 // Optional, defaults to 0
]);

$user->getCreditBucket('credits')->add(100);

$user->getCreditBucket('credits')->use(100);

$creditsToWithdraw = 100;

while ($creditsToWithdraw > 0) {
    $bucket = $user->getDefaultCreditBucket();

    if ($bucket->amount > $creditsToWithdraw) {
        $bucket->use($creditsToWithdraw);
        $creditsToWithdraw = 0;
    } else {
        $creditsToWithdraw -= $bucket->amount;
        $bucket->use($bucket->amount);
    }
}
bash
php artisan honeypot:migration:make
php artisan migrate