Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Events tracking #8

Merged
merged 5 commits into from
Jan 26, 2024
Merged

Events tracking #8

merged 5 commits into from
Jan 26, 2024

Conversation

Safemood
Copy link
Owner

@Safemood Safemood commented Jan 26, 2024

Description

This pull request introduces a new event, DiscountAppliedEvent, in the Discountify package. The primary goal is to provide developers with a mechanism to respond to discount application events within their Laravel applications. Additionally, it includes the integration of a user-configurable settings file.

Changes Made

  • Added the DiscountAppliedEvent class to the Discountify package.
  • Implemented event triggering in relevant parts of the package.
  • Introduced a user-configurable settings file at config/discountify.php.

Usage Example

You can now listen for the DiscountAppliedEvent using Laravel's Event system. Ensure the following configuration in the discountify.php file:

// config/discountify.php
'fire_events' => env('DISCOUNTIFY_FIRE_EVENTS', true) // Toggle event dispatching
// app/Providers/EventServiceProvider.php

use Illuminate\Support\Facades\Event;
use Safemood\Discountify\Events\DiscountAppliedEvent;

public function boot(): void
{
    Event::listen(function (DiscountAppliedEvent $event) {
        // Your event handling logic here
        // dd($event);
    });
}

Check the Laravel Events documentation for more details.

@Safemood Safemood merged commit 1627d13 into main Jan 26, 2024
1 check passed
@Safemood Safemood deleted the events-tracking branch January 26, 2024 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant