Create New Controller with Artisan

If you use Artisan to create your controller, it will create it with boilerplate for all the basic CRUD methods.

php artisan controller:make ProjectsController

Posted in Notes | Tagged , | Leave a comment

Create New Migration File in Laravel

This command will create a new migration file with the Schema::create() method

php artisan migrate:make create_tasks_table --table=tasks --create=tasks

Posted in Notes | Tagged , | Leave a comment

Laravel Project Setup

First, get composer if you don’t already have it (Windows):

Open command prompt and move into www directory (or wherever you want your project to live).

composer create-project laravel/laravel name-of-project
Posted in Notes | Tagged , | Leave a comment

Laravel Links

Here’s a list of links I am keeping as I learn Laravel:–net-36444

Posted in Resources & Tools | Tagged , | Leave a comment

Get the portion of a string after the last occurrence of a character

substr(strrchr($fieldname, "_"), 1);
Posted in Code Snippets | Tagged | Leave a comment

Add Note Within Zend Form

Add a note such as “forgot password” inside a Zend form. I haven’t tried this – I just came across it when I was researching something else but I think I will want it later.

new Zend_Form_Element_Note('forgot_password', array(
    'value' => '<a href="' . $this->getView()->serverUrl($this->getView()->url(array('action' => 'forgot-password'))) . '">Forgot Password?</a>',


Posted in Notes | Tagged | Leave a comment

Check For an Element on the Page with jQuery

Sometimes I write a function that I only want to apply to certain pages. Say, a form. I may need some javascript to apply to the form when I’m inserting and different javascript to apply when I’m editing. Since I’m reusing the form, I just change the id of the form and use this check:

if ($('#insert-form').length > 0) {
// do stuff that only applies to the insert form
Posted in Notes | Tagged | Leave a comment

Naming Controllers and Models with Multiple Words

Here are the rules regarding using multiple words in your controllers and models. Just use capital camel-case.

class Default_Model_TwoWords extends Zend_Db_Table


The name of the file would just be TwoWords.php.


class Default_TwoWordsController extends Zend_Controller_Action


The name of the file would, of course, be TwoWordsController.php.

However, your views will be in a folder called “two-words” and the url will be Note the dash.

Posted in Notes | Tagged , | Leave a comment

How to Authenticate in Zend with Salt

Here’s how to create your own custom Zend_Auth_Adapter to use a salt along with a hashed password. Continue reading

Posted in Tutorials | Tagged , | Leave a comment

Custom Form Decorators in Zend

I found a great explanation of how form decorators work and how to customize them here:

I recently needed to modify the errors decorator so that the entire element (label, input, and error message) was wrapped in a new div. In order to do this I had to create a view partial, which if you haven’t used before sounds a little complicated but it’s not at all. Continue reading

Posted in Tutorials | Tagged , | Leave a comment