Smiley Happy Coder

A new theme for 2015

Well, its been a while in the making.

I finally got around to updating my sites theme.
While the old one worked well enough, it wasn’t pretty and some may say this new version isn’t a vast improvement. But an improvement it is.

There is almost certainly the odd bug here or there, so should you find anything, feel free to shout up either in the comments or hit me up on twitter at @smileyhcoder

That’s all, why not read an article or two while you’re here.

  • Top

Debugging live sites with Laravel’s middleware

Try as we might sometimes things just don’t work on the live site like they do on your development or staging sites.

Today I had that exact problem. I have made a change to my application and deployed it.
The change doesn’t work on the live site. Awesome!

Read On >

  • Top

NFS exports file is invalid in Vagrant

Vagrant Logo

Sometimes you may come up against a random error message when running “Vagrant Up”. Something like “NFS exports file is invalid

NFS exports file is invalid

Read On >

  • Top

Fetching the last insert ID with Laravel

Its fairly common to need to find the ID of the last inserted record.

You could be adding a product to a table and then adding the product ID to a list of categories. Or a similar process on a blog website.

Read On >

  • Top

Filling HTML select elements in Laravel

Filling a select element or dropdown box is something developers do all the time. In plain old vanilla PHP you do something like this:-

Select elements in vanilla PHP sudo code

- Query the database for the content of the select element
- Loop through the results and write out the <option value="$id">$name</option>

Read On >

  • Top

Vagrant sometimes doesn’t refresh my content, whats going on?

I’ve been using Vagrant for a few months now, more specifically a system built on top of Vagrant called Vaprobash by the amazing developer Fideloper. Vagrant is an amazing piece of kit. It’s made my development workflow so much faster and taken away all the nasty pain that comes with MAMP.

Read On >

  • Top

Database transactions in Laravel

Quite often you’ll need to run two database queries that depend on each other.
Imagine you run an online store and for whatever reason you need to remove a category.
What happens to all the products within that category? You might end up with products sitting in your database that nobody will ever be able to see and they get lost or forgotten.
Read On >

  • Top

Laravel design patterns and best practices – A review

Recently I was asked if I would be open to reading a new book on Laravel and of course I jumped at the chance. I’ve been using Laravel for a little over a year now and to be honest I’m really enjoying its power and ease of use.
Read On >

  • Top

All about your user in Laravel’s blade views

In your Laravel projects you will undoubtedly need to display certain links or pieces of information about or for the currently logged in user.

Imagine a simple web application, if the user isn’t logged in then we should surely offer them the chance to.

By the same token it would be weird if when the user was logged in there was still this big button inviting them to log in again. Should that now say “Logout”?

Well, yes it should.

Read On >

  • Top

A little help debugging Laravel sql queries.

One of the problems with these new fangled frameworks is seeing what actually happens in the background.
Sometimes you just need to see what sql queries are being run, so here is a quick snippet for you.

Pop open your global file
app/start/global.php

Read On >

  • Top

Quick Laravel helper to generate Gravatar image

Looking to add a Gravatar image to your Laravel application, of course you are.

Gravatar helper code

If you don’t already have a helpers file go and create one.
Create it in the following folder
app/helpers.php

Read On >

  • Top

Aliases, how to configure them in your terminal

If you develop on a mac or linux machine you will almost certainly enter the same terminal commands over and over again.
If you haven’t already you should probably set up some aliases.

Read On >

  • Top