Learnings Posts

How to use One Signal in Laravel

The OneSingnal is the market leader in push notification providers. It provides mobile + web push, email & in-app messages, and an easy way to send notifications. OneSignal provides official core PHP APIs but not the Laravel package. We are using OneSignal in many projects and write a bunch of line code in all projects where we needed OneSingnal.

One day I had an idea in my mind why I should not write a Laravel wrapper for OneSignal?. Finally, I wrote the shailesh-ladumor/one-signal Laravel Wrapper for it. Using this package, we can write neat & clean code and just a few lines of code.

OneSignal add this package in his official docs here

You can watch the following video tutorial or follow the article.

This package also works with the previous Laravel version.

Today we are going to see how we can use Laravel OneSignal Wrapper in Laravel. Let's see step by step, how we can do that.

Spet 1: Install Packages

Install shailesh-ladumor/one-signal by the following command,

composer require ladumor/one-signal

Step 2: Publish the config file

Run the following command to publish config file,

php artisan vendor:publish --provider="Ladumor\OneSignal\OneSignalServiceProvider"

Step 3: Add Provider

Add the provider to your config/app.php into the provider section if using a lower version of Laravel,

Ladumor\OneSignal\OneSignalServiceProvider::class

Step 4: Add Facade

Add the Facade to your config/app.php into aliases section,

'OneSignal' => \Ladumor\OneSignal\OneSignal::class

Configure a .env file with following keys

ONE_SIGNAL_APP_ID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX 
ONE_SIGNAL_AUTHORIZE=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX X 
ONE_SIGNAL_AUTH_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

ONE_SIGNAL_AUTH_KEY is optional if you do not want to create an app. I hope you are familiar with the One Signal Platform and know how to get APP_ID and AUTHORIZE. If not, you should see the below image for how to get it.

onesignal-in-laravel/1

So, we are done. Let's check how to send push notifications.

Check out this code to send a push notification.

use Ladumor\OneSignal\OneSignal; 
$fields['include_player_ids'] = ['xxxxxxxx-xxxx-xxx-xxxx-yyyyy'] 
$message = 'hey!! This is a test push.!' OneSignal::sendPush($fields, $message);
July 02, 20202 minutesShailesh LadumorShailesh Ladumor
4 Varna in Gita vs 4 Departments in Business

Shreemad Bhagavad Gita has a lot to say about business management. In the last Post of Karma-Yoga, we have seen how our actions should be for the benefits of the others. Today, let's see Chapter 4.

In Chapter 4, Karma-Brahm-Arpan-Yoga (Jñāna Karm Sanyās Yog), verse 13th and 14th, Lord Krishna said,

चातुर्वर्ण्यं मया सृष्टं गुणकर्मविभागश: |

तस्य कर्तारमपि मां विद्ध्यकर्तारमव्ययम् || 13 ||

The four categories of occupations were created by me according to people’s qualities and activities. Although I am the creator of this system, know me to be the non-doer and eternal. (source: holy-bhagavad-gita.org)

પ્રકૃતિના ત્રણ ગુણો એન્ડ કર્મોના વિભાગ પ્રમાણે મેં બ્રાહ્મણ, ક્ષત્રિય, વૈશ્ય અને શુદ્ર એમ ચાર વર્ણોની રચના કરી છે. તેનો હું કર્તા હોવા છતાં પણ તું મને અકર્તા અને અવિકારી જાણ.

न मां कर्माणि लिम्पन्ति न मे कर्मफले स्पृहा |

इति मां योऽभिजानाति कर्मभिर्न स बध्यते || 14 ||

Activities do not taint me, nor do I desire the fruits of action. One who knows me in this way is never bound by the karmic reactions of work.(source: holy-bhagavad-gita.org)

કોઈ કર્મો મને લેપતા નથી, કેમ કે કર્મોના ફળમાં મને લાલસા નથી. આ રીતે જે મનુષ્ય મને જાણે છે, તે પોતાના કર્મો વડે બંધાતો નથી.

Based on occupation & activities, God created the following 4 Varnas:

  • Brahmins - predisposed toward teaching and worship (how to get the God or go to heaven)
  • Kshatriyas - inclined toward administration and management of the kingdom
  • Vaishyas - form the business and agricultural class (Businessmen)
  • Shudras - working class (The actual person who works)

In the same way, we also need 4 Departments in our Business.

  • Brahmins - Marketing - Do the marketing & they actually help us to meet our God (Our Customer).
  • Kshatriya - HR - Form a Business, Hire Team, Appoint People, Make Policies, define Penalties, etc.
  • Vaishyas - Operations - Administration & Management (or your Top Management Team).
  • Shudra - Technical - Actual working people, our employees who actually do work

What God did is, created these 4 Varnas and given them their duties and activities that they need to perform and he simply became A-Karta (non-doer and eternal).

We as CEO, also need to do that same thing. Create these 4 Departments, assign them their duties and just become an external observer. Then all you need to do is, whenever they got stuck, help them, guide them or train them. That's it.

So just simply, Be a God of your Company.

You can also listen to the full podcast here.

January 24, 20202 minutesMitul GolakiyaMitul Golakiya
12 Business Learnings of 2019

2019 was a great year for us in terms of business as well as in my personal life. We had some major breakdowns which taught us lots of good lessons while we resolved them.

1. Do not get your company to rely on one major client

The major mistake we made was our 80% staff had been working for one client for years. And when that work got stopped the 80% company had no work with 50% staff was a senior and experienced developer with top salaries.

Of course, a long term relationship is important but always keep working with multiple clients/people. It will keep your business moving even if one of your work got stopped for whatsoever reason. Because even if you have top talent, getting really good clients is too tough in the market.

2. Everything starts with YOU

Before you transform your business, the first thing that needs to be transformed is yourself. Once you start transforming everything else into your business, your team will start transforming automatically.

Your team learns a lot from you, they are your main observers. Once they see you transforming, their life will also start getting transformed.

3. Wake up Early

All great leaders are early birds. Once you win your morning, you can win the rest of the day. 3 hours of early mornings are the main productive hours. That’s the time when you can complete things that you are not able to complete throughout your day or you are not getting time for.

Also waking up at a fixed early morning time will help you a lot in your health. Wake up at 5 am at least, do some exercise, read, and complete the most important thing in the morning only.

4. Power of Reading

“Not every Reader is a Leader but every Leader is a Reader.”. This sentence has a lot to say. Once you start reading it will transform your life a lot. The good book contains years of research by the author. So you can directly get those years of knowledge by reading that book in just a few days.

5. Increase your Networking

I will say you should meet lots of people. Meet them, talk with them, know them, learn from them even if you are not working with local people.

Plan to meet one good CEO or Coach every month. Invite them to lunch or dinner and try to learn as much as you can from them. Ask about their processes, structures, systems, technologies, etc.

6. Contribution to other’s lives

When you contribute to other people’s lives, that contribution will come directly back to you by double. When you transform their life, your life will automatically get transformed.

7. Get a Coach or Mentor

Always surround yourself with Coaches and Mentors at each stage of life. In Business and Personal life as well. Your coach can be anyone from Friends, Family, or some specialized Mentors and Coaches.

You always need someone who can push you, help you, guide you. Get someone who can give your honest and transparent advice and guidance.

8. Never stop Learning

Never stop learning. Always learn something every day or at least a week. Read Books or Watch Videos or Learn new technologies or Purchase some Courses. Even if you are super busy, put a dedicated time to watch 10 mins video or Read 10 mins every day.

In the long run, just 10 mins of every day will help you a lot.

9. Write Daily Journal

Writing your daily Journal helps a lot. List down your today’s achievements and your tomorrow’s goals. It will help you track your daily progress and plan your day off tomorrow.

When you write a Journal, you will have an exact idea on the next day, what are your priorities in the morning only. Once you plan your day a day, it has tremendous benefits.

10. Delegation

Delegation is really powerful. Before doing any task, just think if you can delegate it then delegate it. Your time is limited and precious, put it on the things where it’s needed rather than doing things that someone else can do from your team.

And if they are not able to do it right now, start training them and make them capable to take off your load.

11. Power of ToDo List

Start Maintaining To-Do list. It has huge power and will bring a great impact. Anything that you need to do, add to your ToDo list. Need to make a call to a friend? add it. Need to send an Email to the client? Add it.

Every small thing should be added to the ToDo list with a due date if possible. It will help you prioritize your tasks and motivate you at the end of the day when you check the list of complete things.

12.Write a Blog

Start writing your blog. It doesn’t need to be fancy or content-rich. Just write down anything that seems to be useful to at least one person in the world. Just write down about things that came to you across the day.

Your blog post doesn’t need to be long. Just write 2-3 small paragraphs and that’s it. But at least start writing something daily/weekly whatever is possible for you.

Hope you enjoyed it and see you next year with new learnings.

January 23, 20204 minutesMitul GolakiyaMitul Golakiya