Ember/Laravel Generator
A Yeoman generator for building Ember web apps with a Laravel Backend
This generator was created to be used with the Ember Laravel Starter Kit but, it can be used without it.
Installation
simply run npm install generator-ember-laravel
or
Simply, clone this repository and then run 'npm link'.
Important: when you clone the repository, clone it into a folder named "generator-ember-laravel". If you do not, the symlink will not work.
From there you can use these Commands:
Commands
App
yo ember-laravel
scaffolds ember app inside main directory like so:
- ember/
- ember/model/
- ember/views/
- ember/templates/
- ember/controllers/
- ember/routes/
- app.js
- routes.js
Model
yo ember-laravel:model modelName attrName2:attrType attrName:relationshipType:relatedModel
generates:
AppModelname = DSModel;
Supported Attributes: string, number, date and boolean
Relationship Support: if you want to include a hasMany or belongsTo relationship, type
yo ember-laravel:model modelName attrName:relationshipType:relatedModel
Controller
Object Controller (default)
yo ember-laravel:controller controllerName
AppControllerNameController = EmberObjectController;
ArrayController
yo ember-laravel:controller controllerName --array
AppControllerNameController = EmberArrayController;
View
yo ember-laravel:view viewName
creates
AppViewNameView = EmberView;
Templates
yo ember-laravel:templates templateName
creates
{{!-- file located at ember/templates/templateName.hbs --}}<h1> templateName Template </h1>
Protip: The command supports subdirectories. So if you type something like
yo ember-laravel:template customers/index
, it would create a template located inember/templates/customers/index.hbs
Routes
yo ember-laravel:route routeName
generates a route file ember/routes/routeName.js
that follows this code structure:
AppRouteNameRoute = EmberRoute;
Note: The file generated will include code that needs to be included in the
ember/routes.js
file.