Camron Cade

Artisan web development, mostly using Laravel.

DB instance without using facades in Laravel's Lumen

The point of Lumen is that it is light and fast, and so by default helpful tools like Eloquent and Facades are disabled. I like to try and keep it light when I am using Lumen, so I opt to not turn them on. If you, like me, are used to using the facade...

Read More

.active classes in menus with Blade templates

In many of my projects, I have a layout blade file that each page extends. As part of the layout, there is a menu bar that has has a different style for a link if you are currently on that page. If you are using bootstrap or foundation, if you apply the css class...

Read More

Cleanly handle the routing for static pages in Laravel/Lumen

I'm working on a small project using Laravel's Lumen that requires a few basic static pages. I was looking for a quicker and more elegant way to define each route and felt like I was repeating myself with every $app->get() function I was writing. I extracted the pages into an array and...

Read More

Limit the number of messages sent on one SMTP connection - Laravel 5

Many SMTP servers have limits on the number of messages that can be sent during any one SMTP connection. If you are sending mail using the built in Mail class with Laravel, any messages sent within a request cycle are sent using one SMTP connection by default. There is actually a quick and easy...

Read More

Disabling CSRF for Specific Routes - Laravel 5

Update: If you are working on Laravel 5.1, there is support for this right out of the box: See this post for more information I've been working with Laravel 5 lately, and it's great. But with a new version comes new defaults. CSRF protection for instance, is now always active with the implementation...

Read More

CasperJS Tips and Tricks

Recently, I was interacting with data from a website that didn't have an API. I've been in this situation before, and it really just entails building a webscraper to fetch the data. Because most of my development recently has been with PHP and Laravel, I usually use Goutte (which is really just a nicely...

Read More