Alex Sears
user

Alex Sears

Developer. Drummer. Ginger.


Featured

article

Laravel 4 Filters in Controllers

Posted on .

Filtering in Laravel 4 is extremely easy. In case you don’t know what I’m talking about, a filter in Laravel is used on a particular route or set of routes to prevent certain people or actions from happening on a particular route. Laravel ships with a few simple but powerful filters to get you started.

Featured

article

Sorting Nested Laravel Collections

Posted on .

Recently, I was working on a project using the Laravel framework. I wanted to retrieve a customer and then display their transactions on a page. However, I needed the transactions sorted from the most recent to the the earliest (descending order).

Featured

article

Rendering Dates as Carbon objects in Laravel

Posted on .

Working with dates in any language can be difficult. PHP is not any different. Though the DateTime class has tons of built in functionality, it still leaves some features to be desired. Thankfully, Brian Nesbitt has created the Carbon class. This is an extension to the basic PHP DateTime class.

Featured

article

Rendering HTML as PHP

Posted on .

Recently, I worked on a project for a customer. They were using a PHP include() to render some PHP inside an HTML file. What the hell?!

After some dedicated Googling, I found out that it’s possible to run an HTML file through the PHP parser to make sure that any PHP in them in rendered. It requires a line added to an .htaccess file.

Featured

article

Explode Names in PHP

Posted on .

Sometimes, a poorly designed form will only have one text box for a user’s whole name (first and last). Normally, though, we want to store it as first name and last name in a database for search purposes. Here is a quick way to split the value of this text input up and to check that it was enter correctly at the same time.

Featured

article

Adding Roles to Laravel Users

Posted on .

The one thing I love about Symfony2 over Laravel is the built in system Symfony has for creating roles. For those of you who don’t understand what I mean by roles, roles allow a developer to bar parts of an application off from users who don’t need access.

Featured

article

Responsive Images

Posted on .

Recently, I had to make a small landing page for a client at my job. I had never done anything with responsive design. So, this became a chance for me to learn something new and fun! A big problem I was having was getting the height to scale with the width.

Featured

article

Tips for Translating a WordPress Website, Part Four

Posted on .

Finally, we have come to the last post in this series…for now at least. We will talk about displaying the WPML language select list in any place your heart desires. Then we will talk about how to personalize this select list for your website.