tastyigniter / ti-ext-payregister

Payment system for TastyIgniter. Allows you to accept credit card payments using payment gateway supplied by this extension or others.
MIT License
8 stars 21 forks source link

[Help on PR] Generete automatically partials for enabled payments after child theme is created. #19

Closed BreakSecurity closed 3 years ago

BreakSecurity commented 3 years ago

As discussed here: https://forum.tastyigniter.com/d/2293-payment

Please point me in the right direction. Part of the code to edit, examples of similar code, etc...

sampoyigi commented 3 years ago

You can start with this within the payregister/Extension file, let me know if you need me to explain what the code does ;)

public function boot()
{
    Themes_model::extend(function ($model) {
        $model->bindEvent('model.afterSave', function () use ($model) {
            if (!$model->wasRecentlyCreated)
                return;

            // Logic here.
        });
    });
}
BreakSecurity commented 3 years ago

Is this be done here? https://github.com/tastyigniter/ti-ext-payregister/blob/a0509e053600140886484e7e2d309590341bbd00/Extension.php#L71

sampoyigi commented 3 years ago

Yup

BreakSecurity commented 3 years ago

Closing since now it is merged