31
loading...
This website collects cookies to deliver better user experience
Let’s solve the imaginary problem we created above.
Now, let’s go to services part. We’ll start by creating a services folder in our app directory to keep them organised. Overall structure is going to look like:
So, we have a social_media department, which has a manager, who manages many platforms, he keeps his platform knowledge in a box named platform to organise better, whenever he needs to work on certain platform, he picks his platform of choice Facebook, Instagram, WhatsApp, etc. and gets the work done.
Somewhat like Neo from Matrix movie.
To share the post to facebook, you can invoke service as:
SocialMedia:: Manager.execute(post, : facebook)
Now, it’s the time when I must say, THAT’S ALL FOLKS. 😇
READ IT, DIGEST IT and then IMPLEMENT IT.