# fluent-cart/1.6.5/database/Seeder/AppliedCouponsSeeder.php

FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler, version 1.6.5. 48 lines.

- Page: https://pluginprobe.com/plugins/fluent-cart/1.6.5/code/database/Seeder/AppliedCouponsSeeder.php
- Raw: https://pluginprobe.com/plugins/fluent-cart/1.6.5/raw/database/Seeder/AppliedCouponsSeeder.php
- Modified: 2025-11-20T13:11:16+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/fluent-cart/1.6.5/code/database/Seeder/AppliedCouponsSeeder.php#L10-L20`.

```php
<?php

namespace FluentCart\Database\Seeder;

use FluentCart\App\Models\AppliedCoupon;
use FluentCart\Faker\Factory;

class AppliedCouponsSeeder
{
    public static function seed($count)
    {
        $faker = Factory::create();

        $appliedCouponsLists = [];

        if (defined('WP_CLI') && WP_CLI) {
            $progress = \WP_CLI\Utils\make_progress_bar('%CSeeding AppliedCoupons', $count);
        }
        for ($i = 0; $i <= $count - 1; $i++) {
            if($i%2==0){
                $code = 'TEST101';
            }
            else {
                $code = 'TEST102';
            }
            $appliedCouponsLists[] = [
                'title' => $faker->text(200),
                'code' => $code,
                'status' => $faker->text(20),
                'type' => $faker->text(20),
            ];

            if (defined('WP_CLI') && WP_CLI) {
                if ($i !== $count - 1) {
                        $progress->tick();
                }
            }

        }
        AppliedCoupon::insert($appliedCouponsLists);
        if (defined('WP_CLI') && WP_CLI) {
            $progress->tick();
            $progress->finish();
            // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
            echo \WP_CLI::colorize('%n');
        }
    }
}
```
