dev-master
9999999-dev
The Requires
by Boy Hagemann
Wallogit.com
2017 © Pedro Peláez
With this package you can:, (*1)
Use [Composer] (http://getcomposer.org) to install the package into your application, (*2)
require {
"boyhagemann/model": "dev-master"
}
Then add the following line in app/config/app.php:, (*3)
... "Boyhagemann\Model\ModelServiceProvider" ...
// Get a fresh ModelBuilder instance $mb = App::make('ModelBuilder'); // Set the name of the model class $mb->name('Article'); // Set the database table $mb->table('news'); // Change the folder where to store this model $mb->folder('/app/models'); // Add columns to the table, each with their own fluent interface // depending on their type of column. $mb->string('title')->required(); $mb->text('description')->length(50); $mb->integer('number_of_views'); // Add relationships, each with their own fluent interface // depending on their type of relationship. $mb->hasOne('Category');
This package checks if the model exists yet in the IoC container. If it doesn't, then the Eloquent model file is written to disk and the database table is created. During development it may be handy to keep updating your database the moment you changed your configuration., (*4)
$mb->autoGenerate();