Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Laravel Scaffolding
Latest commit 5c6fabc @loic-sharma Fixed #8

Scaffold Laravel Bundle

Easily create scaffolds to manage your database.


Install using the Artisan CLI:

php artisan bundle:install scaffold
php artisan bundle:publish

Then, place the bundle's name in your application/bundles.php file:


return array(


Don't forget that each time you generate a scaffold, you will need to add the Controller in your routes. Or, simply use this:



A Few Examples

Creating a full Blog... in seconds!

Say you want to make a blog that contains posts that are posted by users. You could manually code all of that, or you could just run:

$ php artisan scaffold::make blog.comment content:text,user timestamps
$ php artisan migrate

$ php artisan scaffold::make title:string content:text belongs_to:user has_many:blog.comment timestamps
$ php artisan migrate

$ php artisan scaffold::make user username:string password:string,blog.comment
$ php artisan migrate

Now isn't that a bit faster?

Dissecting the Blog Example

This is the basic structure to generate a new scaffold:

php artisan scaffold::make <name> <attributes> <relationships> <timestamps>

name: The scaffold's name (always singular). Notice that the scaffold can be nested by adding a prefix and a period.

attributes: The scaffold's attributess, separated by a space. The different supported attribute types are: string, integer, float, boolean, date, timestamp, text, and blob. The general syntax for an attribute is:



Additionally, you can make a attribute nullable:



Or, you can set a character limit for an attribute:



You can even set a character limit and make an attribute nullable:



relationships: The relationships between this scaffold and other scaffolds, separated by a space. The different supported relationships are: has_one, has_one_or_many, belongs_to, has_many, and has_many_and_belongs_to. The general syntax for a relationship is:



Note that the scaffold is always in its singular form. Additionally, several similar relationships may be defined at the same time using a comma (but no spaces):



It is important to note that the different scaffolds listed within a similar relationship should be ordered by importance. For example, a post is more important than a comment. Additionally, if the scaffold is nested it should be prefixed like so:,blog.comment

timestamps: If included, this will make the scaffold automatically timestamp when rows are created or updated. If timestamps is omitted, the scaffold will not do this.

Something went wrong with that request. Please try again.