Support the ongoing development of Laravel.io →
posted 10 years ago
Packages
Last updated 1 year ago.
0

I have added the ability to add relationships. So now you can type

Book belongsTo Author title:string published:year

and it will generate your Book model with method author, and also will allow you to create the Author model with a "hasOne" or "hasMany" relationship back. It also automatically adds the author_id attribute to the migration. To add the Author, you can type:

Author hasMany Book name:string address:string

and this will create the books method on Author and assign author_id as a foreign key to Author.

Next I am going to implement "Faker" so that you have the ability to add in fake data to test your application. This may be a bit tricky with relationships because of foreign key issues and such, but I'm sure I will think of a way to do this.

I am excited about the possibilities of this command and I hope that you all check it out to give some feedback and, ya know, code faster.

Last updated 1 year ago.
0

Sorry for all of the posts... but I have now added in Faker support. The default is to attempt to choose a Faker type based off of the properties you supply and seed 10 rows in the database with that data. However, this doesn't yet fill in foreign keys appropriately (assigning foreign keys may still be a bit buggy).

Some things I'm hoping to implement:

  • Automatically generating javascript files based on the framework you are using
  • Smarter faking of data, along with support to fill in foreign keys
  • Adding multiple relationships and smarter handling of relationships in general
  • Better error handling
Last updated 1 year ago.
0

Just view your github recently. I was wondering:

  1. Does this now support 4.1
  2. How different are your new functions from Jeffery's generator?
Last updated 1 year ago.
0
  1. Yes it does.
  2. It's like Jeffrey Way's command on steroids. Jeffrey Way's generators has a command to scaffold a single model, which creates:
  • Model
  • Controller
  • Views
  • Migration
  • Seed

My starter command does all of that, plus:

  • Starts your application from scratch. It will create your layout file for you, download bootstrap and your javascript files for you, and add them to the new layout file.

  • Sets up relationships. So you can run "Book belongsTo Author title:string" and it will automatically set up that relationship in the model and in the migration. It will even set up the foreign keys for you when seeding.

  • Namespacing - Who doesn't use this on any decent sized application?

  • Integrates with Faker to automatically seed mock data for you

  • Sets up the repository pattern. This makes your application much more testable and really is what you should be doing for any real world project.

  • Creates basic tests. It sets up controller tests.

I also have some cool future ideas such as scaffolding javascript framework files.

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

netorious netorious Joined 1 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.