In this article I am going to explain how to exclude a subdirectory from routing in Laravel 5. Let's say, for example, you have a Laravel 5 application installed at http://www.example.com and you wish to install a WordPress blog in the subdirectory http://www.example.com/blog. Unfortunately it is not as simple as just creating subdirectory under Laravel 5 and assuming it will all work properly. You will need to make a few edits to you NGINX configuration files (Please note that this article assumes you are running NGINX on your server. This can still be done under Apache, you will just have to convert the rewrites to Apache.). Although my focus in this how-to will be on WordPress, the same steps could be taken to install any application (i.e. a forum) to run in a subdirectory of a Laravel 5 application. It is important to note that WordPress may appear to function properly after a base install, if you enable permalinks on your WordPress install you will begin to see issues with … [Read more...] about Exclude Subdirectory from Routing in Laravel 5
How to fix JQuery Steps Plugin saveState not working
I have found one of the better JQuery wizard builders available is JQuery-Steps.js. Unfortunately the latest version of JQuery Steps does not support the newer versions of js-cookie.js when saveState is set to true. This can be frustrating if you do not initially realize the saveState problem is directly related to the version of js-cookie.js you are using. In the meantime, you will not see errors being returned in the console, the only issue is that when you navigate away from the wizard, and then return, your state is not saved. While it is true you could probably get away with using the older version of jquery-cookie.js, why risk it, especially if your application already utilizes the newer version. Fortunately this is a quick and easy fix, and while we are at we will add an extra option to set the cookie expiration. Fixing the saveState issue in JQuery-Steps.js with the latest version of js-cookie.js: First, make sure you download and include the latest version of js-cookie.js … [Read more...] about How to fix JQuery Steps Plugin saveState not working
Laravel 5.2 – Forcing HTTPS Routes when using SSL
There is an increasing push for privacy and security on the web and a lot of this starts with sites using SSL to encrypt their traffic. With SSL certificates now free from companies like Amazon recently launching their AWS Certificate Manager and initiatives like Let's Encrypt there really is no reason now that sites should not have SSL. This article though is not about encryption, installing SSL, or your need for SSL in general. Instead I want to focus on after you have chosen to implement SSL on your site. Particularly if you are using AWS Certificate Manager (ACM) with an Amazon Elastic Load Balancer (ELB) in front of a Laravel 5.2 site. You may like many others choose to keep it simple and have the ELB forward port 443 (HTTPS) to port 80 (HTTP) on your EC2 instance. In this case there you may not have a certificate residing on the EC2 instance(s) and you may not have the EC2 instance configured to handle requests on port 443. If you are using Laravel 5.2 this may present some … [Read more...] about Laravel 5.2 – Forcing HTTPS Routes when using SSL
Creating a Free Stripe Plan using Laravel 5
I am not sure why this isn't better documented (at least not that I could easily find), but often times when building a subscription-based service (SaaS) you may want to offer a free plan along with your premium paid plans. I am not talking about a free trial period, but a forever free plan. For some reason, the Laravel documentation wants to assume only that you would offer a free trial period. There are a couple ways you could handle offering a free Stripe plan using Laravel, but I am going to highlight the one I prefer. The reason I prefer this method is it makes upgrading, downgrading, and managing customers much simpler if you don't have to worry about the backend headaches of having free users configured one way and paid users another way. With this method they are all managed by Stripe, and when you want to upgrade you simply pass billing information, and if you want to downgrade a user you can simply use the Stripe API to handle the plan switch. For brevity, I am going to … [Read more...] about Creating a Free Stripe Plan using Laravel 5
Using Laravel 5 Stripe Webhooks
Handling Stripe webhooks in Laravel 5 is fairly straightforward and simple, however, the Laravel is slightly lacking in several pieces. The default Laravel 5 setup includes the capability to handle two webhooks out of the box. The first is the customer.subscription_deleted and the second is invoice.payment_failed. Expanding on these two webhooks or adding additional webhooks is fairly easy. Create a webhook controller. In some instances you may have multiple webhook controllers for various services (i.e. Stripe, MailChimp, Twilio, etc...). I typically like to put my webhook controllers in a separate controller directory and name each one specific to the service. So for example, I will create a directory App/Http/Controllers/Webhooks and in that directory I would create a controller called StripeController to handle the Stripe webhooks. The basic setup of your controller then should look something like this: [crayon-5c6d09cf600bd770976040/] The above controller will now handle … [Read more...] about Using Laravel 5 Stripe Webhooks
JQuery Session Timeout
Most web applications require a user to login and use sessions to track the user's activity on the site. For security purposes, it can also be desirable to, after a certain period of time of no activity, to automatically log the user out. There is an easy to use plugin for just this purpose that works nicely with the Twitter Bootstrap framework. The Bootstrap Session Timeout plugin by Orangehill Development, is a great and easy to use plugin with many configuration options. You can find the plugin here https://github.com/orangehill/bootstrap-session-timeout There is, however, one small bug that I found. When the modal pops up to alert the user their session is about to expire, any movement of the mouse will automatically close the modal. This can be very undesirable as a mouse could easily be knocked or the user could be doing something completely unrelated. To resolve this issue we must edit the bootstrap-session-timeout.js file (unfortunately you will have re-minify if you wish … [Read more...] about JQuery Session Timeout
Observations from 1000s of attorney websites
I have been working on a project recently that required going through 1000s of criminal defense attorney websites across the United States. Now I realize there are some "rules" on exactly how attorneys can advertise and what they can, and cannot, say in those advertisements. One thing is obvious though from looking at these sites. Either attorneys are overly cautious with their websites or the Internet is simply not an area where they feel they should devote marketing dollars. As phonebooks fade into the history books, more and more people use the Internet to find businesses. Personally, and I know I am not alone in this thought, when researching a business and deciding whether or not to do business with them, my first impression is their website. If the site looks like something from the mid-1990s and doesn't look like anyone has put a thought into updating it since then they are most likely going to get skipped over. Now this doesn't mean I am looking for some big fancy website, … [Read more...] about Observations from 1000s of attorney websites
Google is evil
As much as Google likes to deny they are evil their drive for revenue has overtaken their drive to provide users the best product when it comes to search. They are using the ad dollars from search to subsidize the hundreds of business ideas the leadership comes up with. And people and governments are noticing. Jason Calacanis recently posted about how Apple was quietly building a search engine of their own and is posed to potentially take on, or over, Google. And I agree with him. It is clean, easy to use, not full of hundreds of ads, and provides the results I am looking for. While the way Google displays ads is definitely of concern and even I find myself having to double check I am not clicking on an ad sometimes. My bigger concern is their algorithm in general. While updates like Panda and Penguin are said to have eliminated search spam, I actually believe they increased the spam to some extent. When I search for a person I am usually trying to find one or two things about that … [Read more...] about Google is evil