Skip to main content

Posts

Showing posts from September, 2013

Form macros in Laravel

Form macros are a really cool part of Laravel. They are described in the documentation, but that doesn't show you exactly how to use them in your application. So here is how I do it.

Load macros on the start of the application To register the macros if we follow the docs we simply need to do something like

Form::macro('myField', function() { return '<input type="awesome" >'; });
But how do we get this to load when needed? My solutions is to simply have it load on the start of the application. I do this by making a folder in my app directory called "misc" which just holds files for different things that I have to startup this way. Inside of that folder I make a file called "form_macros.php". To load this file on startup, we are going to require it within app/start/global.php. Simply add
require app_path() . 'misc/form_macros.php'; to the end of the global.php file. This will make sure that the form macros are loaded up …

Resources and Tools

These are some of the resources and tools that I use regularly.

Mozilla Developer Network which is a documentation site which aims to centralize web development documentation for standard technologies.For a basic code editor with advanced plugins available, I recommend Visual Studio Code. If you want a full Integrated Development Environment, then it's WebStorm that I personally use.Open Courseware. This is an awesome initiative by higher-education to release their course materials and even recordings of the lectures online for free viewing. I recommend going through MIT's Introduction to Computer Science and Programming course to get started.Here are some blogs and people that I followHTML5Rocks is an amazing resource for detailed blog posts on the technical aspects of HTML5 features. The why and how of the specs are discussed and what the best way to go about doing things is. An oldie but goodie here is How browsers work which is a must-read. Smashing Magazine is a great blog…