Wallogit.com
2017 © Pedro Peláez
This package will generate a Laravel Model based on your database table itself, filling in the required fields automatically.
Model Generator - Will read your current table structure and generate a model will the filled in fields automatically., (*2)
You can generate a single table model, or multiple at once., (*3)
Author(s): * Laracademy (@laracademy, michael@laracademy.co), (*4)
composer require "laracademy/model-generator"
The easiest method is to add the following into your config/app.php file, (*5)
Laracademy\ModelGenerator\ModelGeneratorServiceProvider::class
Depending on your set up you may want to only use these providers for development, so you don't update your production servers. Instead, add the provider in `app/Providers/AppServiceProvider.php' like so, (*6)
public function register()
{
if($this->app->environment() == 'local') {
$this->app->register('\Laracademy\ModelGenerator\ModelGeneratorServiceProvider');
}
}
Now that we have added the generator to our project the last thing to do is run Laravel's Arisan command, (*7)
php artisan
You will see the following in the list, (*8)
generate:model
The command comes with a bunch of different options and they are listed below, (*9)
migrations table and no model will be generate for itphp artisan generate:model --table=users
php artisan generate:model --table=users,posts
php artisan generate:model --all
database.php and generating models for all tablesphp artisan generate:model --connection=spark --all
ModelGen is open-sourced software licensed under the MIT license, (*10)
Please add as many details as possible regarding submission of issues and feature requests, (*11)
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE., (*12)