Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Laravel News:
Improved model generation with Laracademy Generators
Sep 08, 2016 @ 16:18:24

The Laravel News site has a quick tutorial posted showing you how using smarter generators to make model classes can help reduce your development time in Laravel applications (using a package to help adds the "smarts" needed).

Laravel provides the Artisan command line tool that allows you to save time by including several generators. Some examples include make:controller, make:model, and make:migration.

Building on top of this idea is a third party package named Laracademy Generators that will automatically generate your models based on your database structure.

They show first the normal process for creating a model and matching migration with the "artisan" command. Once this migration is run and the table is created, they can show how to automagically enhance the model with the generators package, using it to read from the table in the database and update the model with "fillable", "casts" and "dates" properties filled in.

tagged: model generator laracademy package improved database migration

Link: https://laravel-news.com/2016/09/improved-model-generation-with-laracademy-generators/


Trending Topics: