zgabievi/nova-promocodes

A Laravel Nova tool.

9.0.1 2022-03-15 11:11 UTC

This package is auto-updated.

Last update: 2024-04-15 15:37:01 UTC


README

#StandWithUkraine nova-promocodes

nova-promocodes

Packagist Packagist license

Coupons and promotional codes generator for Laravel Nova. This package is created for zgabievi/laravel-promocodes.

Installation

You can install the package via composer:

composer require zgabievi/nova-promocodes

Configuration

php artisan vendor:publish --provider="Zorb\NovaPromocodes\ToolServiceProvider"

Now you can change configurations as you need:

return [
    'models' => [
        'promocodes' => [
            'resource' => \Zorb\NovaPromocodes\Resources\Promocode::class,
        ],

        'users' => [
            'resource' => \App\Nova\User::class,
        ],
    ],
];

After you configure this file, run migrations:

php artisan migrate

Usage

It's very easy to use. Methods are combined, so that you can configure promocodes easily.

Reference

Name Explanation
Mask Astrisks will be replaced with random symbol
Characters Allowed symbols to use in mask replacement
Multi use Define if single code can be used multiple times, by the same user
Unlimited Generated code will have unlimited usages
Bound to user Define if promocode can be used only one user, if user is not assigned initially, first user will be bound to promocode
User Define user who will be initially bound to promocode
Count Amount of unique promocodes should be generated
Usages Define how many times can promocode be used
Expiration DateTime when promocode should be expired. Null means that promocode will never expire
Details Array of details which will be retrieved upon apply

Include Tool

Include promocodes tool inside nova service provider.

use Zorb\NovaPromocodes\PromocodesTool;

class NovaServiceProvider extends NovaApplicationServiceProvider
{
    // ...

    /**
     * Get the tools that should be listed in the Nova sidebar.
     *
     * @return array
     */
    public function tools()
    {
        return [
            PromocodesTool::make(),
        ];
    }
}

Parent Package

For more information about parent package, visit zgabievi/laravel-promocodes.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.