concord icon indicating copy to clipboard operation
concord copied to clipboard

Hooks?

Open elfeffe opened this issue 4 years ago • 5 comments

Does it supports Hooks? I have found this package https://github.com/tormjens/eventy But does your package offers that functionality?

elfeffe avatar Jun 21 '20 12:06 elfeffe

No, apps written with Concord are typically using the default Laravel Event system to achieve such functionality. Concord itself fires a couple of events and also supports apps/modules to disable events.

Nevertheless, you can use the mentioned package along with Concord without any problems.

Does this properly answer your question?

fulopattila122 avatar Jun 21 '20 13:06 fulopattila122

Sorry, but can you show me how to do that? Because the conventional approach is very criticized because “listeners but not return values”. What I need is to create some event getPaymentMethods and the plugins must return their methods. Do you have any example?

elfeffe avatar Jun 21 '20 19:06 elfeffe

As an example, the Vanilo Payment module (which is built on top of Concord) is using the registry pattern to achieve such functionality: https://github.com/vanilophp/payment/blob/master/src/PaymentGateways.php#L22

And any plugin for the payment module can register itself with PaymentGateways::register(...) Example plugin registering itself: https://github.com/artkonekt/vanilo-euplatesc/blob/master/src/Providers/ModuleServiceProvider.php#L26

fulopattila122 avatar Jun 21 '20 19:06 fulopattila122

Great, thanks a lot

elfeffe avatar Jun 21 '20 19:06 elfeffe

@fulopattila122 I didn't see you are the developer, I have been following Vanilo for some time, from the first beta. When do you plan to release the payments ans shipping modules? I think I can use them in my project.

elfeffe avatar Jun 21 '20 21:06 elfeffe