Category Archives: Laravel

Using Laravel: How To Use Routes, Controllers and Filters For Public and Private sections of a CMS site

If you are reading this you probably already know what Laravel is, but just in case: it’s a PHP framework for building applications. It has all the typical stuff such as MVC, DAO, ORM, a templating engine (also supports Twig from Symfony), routes, controllers, clean URLs, RESTful support etc. I really like it because it’s very clean and compact to code in. It’s also much simpler to get started with than something like Zend Frameworks 2, for example, as it doesn’t require a complex install process or configuration. In fact it pretty much just runs out of the box.

Other Tutorials on Laravel

There are a few (very few) tutorials on Laravel. If you prefer learning by watching videos I can highly recommend this series by Andrew Perkins. One text-based tutorial I’ve been working through is Dayle Rees’s. One weakness of his articles is that he starts out showing you how bits hang together, but by the time you get to filters he loses the plot and stops giving you a step-by-step working example- he teaches you concepts but doesn’t show them all working together. This is the case with his discussion about securing an admin section of your site, for example. Another tutorial, written by Nikko Bautista, covers some of the same ideas. That one also leaves some gaps. So here’s my attempt to provide a full working example, along with an explanation of how all the bits and pieces relate to one another.
Continue reading