Smiley Happy Coder

I'm a web developer with a love of technology and I'm a bit of an Apple geek

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 >

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 >

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 >

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

Read On >

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

Read On >

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 >

Laravel Environment Detection

One thing you’re almost certainly going to run into quick quickly in your Laravel career is environment detection.

Laravel users environments so that you can really easily set up differing configurations depending on your live or staging or local environments. The most basic example is database connections.

Read On >

A required skill for an internet age.

All too often and I mean ‘too’ often, I get asked a question. Now before you go off and shoot me down for being a complete a*se I certainly don’t mind helping people but there are a couple of things that are just plain lazy. Finding answers is a required skill these days.

One of the more annoying types of questions that comes to mind is asking something again and again. Read On >

Add SSH keys to your Mac or Linux machine

If you’re using a server such as Github or Nitrous it stands a fair chance that you’ll have to add SSH keys and supply these services with your public key.

A good explanation of SSH keys can be found on Wikipedia

Before we add ssh keys, do you already have any setup?

Read On >

Adding the Post ID to the WordPress Admin area

In a large complex WordPress installation you can sometimes have a lot of pages and posts and sometimes it becomes hard to find anything. Being able to find a post by post ID in the admin area could be a bit benefit.

I’ve recently been working on a WordPress site that has over a hundred pages Read On >

Find the ID of your home page in WordPress

Today I needed to find the ID of my home page in WordPress.

I spent a while looking in the codex and in the forums and all I found were a few unanswered posts.

It must be stored somewhere

Well as you’d imagine the ID of the home page is indeed stored in your database.

Logic dictates that it would be found in the options table and indeed it is.
Read On >

Externally connecting MySQL in Vaprobash

This post is more of a note to myself than anything else.

This is becoming a trend for my blog, posts that are only of use to me, but still…

Read On >