I have multi endpoint for my website ( Backend, Api, internal api for application and ... )
There is a lot of code that duplicate between this endpoints.
for example for signup I repeat these lines 3 times
$user = User::create(['email'=>input('email')])->save(); Email::signup($user); // and there is more logic
So my question is how to prevent duplicate some business logic? where to put these shared logic in
As I know in
MVC controller is for business logic, but how Can I share my codes between them?
I have some shared logic between my endpoint and also each end point has individual logic too.
these business logic is about application behavior (not validating and other stuff that relative to model).