Link

The Rework Podcast – Jason Friend at Industry 2017

I know many of you know Basecamp but do any of you follow Jason Fried, CEO of Basecamp. Jason has become quite a controversial, outspoken person online. He has published some amazing ‘best seller’ books, and I recommend you all read ‘Getting Real’ (available as a free PDF)

Anyway, they have recently started to publish a new podcast called Rework. On my run this morning I listened to this one https://rework.fm/jason-fried-industry-2017 and there were some comments in it that really struck me as important so I thought I would share.

Enjoy.

Laravel Watchable Package

I created this package to ‘scratch my own itch’. I have a model called Order. I wanted to notify certain people (only people who were watching the order) when the status of the order changed.

In this article, I will give you some boilerplate code that you can use in your application to wrap around the Laravel Watchable package.  If you fancy reading a little more about why I needed to build it in the first place, read the “A little background into ‘Why'” at the end of the page.

The problem

In the documentation, under the Using The Notification Facade section, you can see the example below.

However, the question is, how do you get the users? What I want to be able to do is send a collection of users who are watching the model.

The solution

Install the Laravel Watchable Package (https://github.com/jamesmills/watchable)

Remember to add the trait to your model. Throughout this post, I will use Order as the example.

Once you have the package installed this will help you handle the watchable request on the model. However, you will still need to add some additional functionality to your application. Below is some scaffolding which I hope will help.

I have created a separate controller to deal with this so that I can reuse the same controller for any models I want to be ‘watchable’.

To use this controller remember to add the route!

Now you can use the example below in your view file when you are showing the model you want to be watchable.

Important: The key thing to remember is that we send a hidden field with the ‘key’ as the model name you want to watch/unwatch. This is what makes our controller code reusable.

Now that we have added the ability for someone to be able to watch your model we can simply get the watchers of the model when we perform an action on it.

The below is a simplified version of what we have in our application when an order gets paused.

Notes

I use the Laracasts Easy Flash Messages for the flash()->success(‘message’) messages you can see in the controller to display the watching status back to the user after they have clicked the button.

A little background into ‘Why’

At Clicksco we are experts in traffic acquisition and we use this skill to drive traffic to highly optimised landing pages to generate form fill leads for a number of partners focusing in the financial industry.

We partner with a company called Lead Byte for lead processing and delivery which we use in combination with a number of in-house systems to manage the entire lead lifecycle.

A few months ago I was working on a new lead ordering module which would allow us to create an order for leads and have the system manage it. A lead order is when a company comes to us and says they will buy X number of leads from us. They might require people looking for Y product and the value of their fund might have to be above Z.

Within Lead Byte we set all the delivery configurations so we can delivery the lead directly to the clients CRM. We also set up rules to make sure the correct partner gets the correct leads. The one thing we were missing was being able to create a lead order to fit various scenarios. (Example: Send 
20 leads daily until a total of 500 leads have been sent or until 22nd Oct 17).

Using a combination of Laravel, Pusher and Vue we implemented our solution in our main system (we call this the PMD). What was missing was a way for us to notify specific people when certain things happened to an order. For example, when the daily frequency was met and the order was paused. Or, when the total number of leads for the order was delivered so the order is closed. Using Laravel 5.5 Notifications it’s easy to send out these notifications using a selection of different channels but the tricky part comes when you need to decide who to send the notification to.

The is why the Laravel Watchable package was developed. I allow anyone who can log into the system to ‘watch’ an order. Once they are a watcher of a lead order they will automatically get all notifications of all order status changes. It’s easy to find the order, get all its watchers and then send a notification to everyone who is watching.

 

Dubai Digital & Tech event by AstroLabs

Yesterday I attended my first meetup event in Dubai. Given the recent work I am doing on our own Analytics and the event was titled ‘Web Analytics Wednesday!’, I thought it would be a good one to start with.

The event is on Meetup.com and can be found under ‘Dubai Digital & Tech‘.

Dubai Digital & Tech is a community driven initiative of free meetups for knowledge sharing in the digital and tech space

It was hosted by AstroLabs who are based in a really nice space in JTL, Cluster R.

AstroLabs Dubai is the region’s premier coworking space for digital technology companies. We help startups set up a presence in Dubai and provide a platform for them to scale globally.

The main speaker was Rakesh Ramesh  who is the Digital Marketing Director at Careem. He gave a talk entitled “Careem Success Story – Building mobile first companies to scale through proper measurement solutions”.

It was an interesting talk with some good takeaways however the more interesting thing for me was to get to see what AstroLabs was and what it was all about. They have three main packages which might be of interest:

Moonlighter 750 AED monthly – Nights & Weekends space access, high speed internet, meeting rooms, printing, office supplies, and coffee/snacks

Community Member 1,500 AED monthly – 24/7 space access with high speed internet, bookable meeting rooms, printing, office supplies & coffee/snacksOn-site mentorship + office hours

Member 2,500 AED monthly – Annual contract includes DMCC Free Zone Trade License at no cost. Account manager to help you establish your company.

To find out more about these packages check out their pricing page.

I am looking forward to attending more of their evenings in the near future.

Video

The Millennial Question

Quite frankly one of the most interesting people I have ever listened to. I have a couple of books by Simon Sinek after I came across his video on TED Talks about ‘How great leaders inspire action‘.

The below video is an excerpt from a longer video where he was a guest on Inside Quest. I have linked to the full video below too. I came across the video because someone shared it on Facebook. ‘The Millennial Question’ is focused on a subject that really interests me as I find myself managing and working with more Millenials as my career progresses.

By 2025, Millennials will make up 75% of the global workforce

Watch it and let me know in the comments what you think.

For more information you can visit http://www.startwithwhy.com/millennials

 

Laravel Eloquent relationship query

I am working on a tool at the moment which is built on top of Codebase. I am going to blog later in more detail about this tool. For now, I want to touch on a specific Laravel issue I had yesterday.

We also use TeamWeek to plan on a more top level. TeamWeek enables us to plan on a weekly and monthly basis who will be working on what and when.

One thing that’s been annoying me for a while is having to duplicate information and use two tools. So we have been pulling our own TeamWeek view inside our internal application.

We have users and tickets. What I wanted to do was pull all users along with their tickets which match a given condition. I did not want all users and I did not want all tickets. The condition was that the started_at and deadline_at columns must not be null. I also only wanted tickets that either start or end within a given time frame.

What I eventually came up with was a query that searched for all users which had tickets that matched this condition. Then I added looked up only the tickets that matched the condition.

I am not confident this is the best Eloquent solution, but it works.

Comments welcome!

Link

Free Grammar Checker

I stumbled across Grammarly, I actually think it was a Facebook Ad of all things. I liked the idea of adding the Chrome browser extension because it would mean that I could use it for nearly everything that I do day to day.

So far my experience has been good and so I thought it would be worth a share!

Grammarly makes sure everything you type is easy to read, effective, and mistake-free. Try it today:

Source: Free Grammar Checker | Grammarly

Laravel Envoyer & FreeBSD mv: illegal option — T

UPDATE

Originally Taylor tried to ‘lookup’ the operating system you were using and then use the correct command. Unfortunately, this broke things for other users so he had to roll it back.

So he has now included a config option


I have been meaning to try Laravel Envoyer for some time now. At work we have a deployment process which is mainly focused around Codeship with some custom scripts that are either on the server or committed to the repo.

Although there are many options for zero downtime deployment I really like the idea of using Envoyer so I decided to give it a go. Nearly all of our servers are FreeBSD for various reasons and as I excitedly watched the deployment happen for the first time I was disappointed when I saw ‘Finished With Errors’. I clicked on the output button with provides you with some more feedback and I was faced with a rather confusing message.

screenshot-2016-09-29-09-10-11

It looks like the option -T is not available on FreeBSD as it is in Linux systems so the final step where Envoyer activates the new release is not able to move the ‘current-temp’ folder to be the ‘current’ folder.

I sent a tweet out to see if anyone else was having this issue or if it was something I was doing wrong. I got a helpful tweet back from @FreeBSDhelp which confirmed that the option -T was not available.

Interestingly if you run the move command without the -T and you already have a current folder it will place the ‘current-temp’ folder inside the ‘current’ folder resulting in ‘/home/forge/domain.com/current/current-temp/’, obviously not what we are looking for. So it looks like the option in FreeBSD is to replace the -T option with -h which will do a similar thing.

So for FreeBSD we need to run

and on all other we can run

I have exchanged a couple of emails with Taylor and I hope that we will see this merged into Envoyer soon so that I can continue my trial of the product.

I would love to hear from anyone else who has had the same issue.

Video

Laravel 5.3 Overview

I am sure many of you who follow Laravel will know that it was Laracon US just a few weeks ago (July 27-29, 2016 in Louisville, Kentucky). I purchased a live streaming ticket because I was unable to attend the conference this year.

The website that is hosting the video has just released all the videos for free open access now, so get yourself along to https://streamacon.com/video/laracon-us and enjoy!

It’s also worth keeping your eye on Laracon EU which is when it’s rumoured Laravel 5.3 will be released!

Screenshot 2016-08-16 08.53.52

 

Some of my other favourites include:

Source: Watch Taylor Otwell – Laravel 5.3 Overview from Laracon US!