Skip to content
Laravel Components for code generation
PHP
Branch: master
Clone or download
CristianLlanos Merge pull request #110 from syclone/patch-3
Add Support for Larapack\DoctrineSupport
Latest commit b443f53 Sep 2, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config Apply fixes from StyleCI May 18, 2018
src Add Support for Larapack\DoctrineSupport Aug 11, 2018
tests Applied fixes from StyleCI Oct 19, 2016
.gitignore Add ".idea" to .gitignore Dec 3, 2017
.travis.yml Update travis file Oct 21, 2016
CHANGELOG.md Fix #13 - Update Changelog Feb 4, 2017
LICENCE.md Add changelog and license files Nov 1, 2016
README.md Update README.md Aug 2, 2017
composer.json Update composer.json Jun 28, 2017
phpunit.xml Reliese Laravel Oct 16, 2016

README.md

Reliese Laravel

StyleCI Build Status Latest Stable Version Total Downloads Latest Unstable Version License

Reliese Laravel is a collection of Laravel Components which aim is to help the development process of Laravel applications by providing some convenient code-generation capabilities.

How does it work?

This package expects that you are using Laravel 5.1 or above. You will need to import the reliese/laravel package via composer:

composer require reliese/laravel

Configuration

Add the service provider to your config/app.php file within the providers key:

// ...
'providers' => [
    /*
     * Package Service Providers...
     */

    Reliese\Coders\CodersServiceProvider::class,
],
// ...

Configuration for local environment only

If you wish to enable generators only for your local environment, you should install it via composer using the --dev option like this:

composer require reliese/laravel --dev

Then you'll need to register the provider in app/Providers/AppServiceProvider.php file.

public function register()
{
    if ($this->app->environment() == 'local') {
        $this->app->register(\Reliese\Coders\CodersServiceProvider::class);
    }
}

Models

Generating models with artisan

Add the models.php configuration file to your config directory and clear the config cache:

php artisan vendor:publish --tag=reliese-models
php artisan config:clear

Usage

Assuming you have already configured your database, you are now all set to go.

  • Let's scaffold some of your models from your default connection.
php artisan code:models
  • You can scaffold a specific table like this:
php artisan code:models --table=users
  • You can also specify the connection:
php artisan code:models --connection=mysql
  • If you are using a MySQL database, you can specify which schema you want to scaffold:
php artisan code:models --schema=shop

Customizing Model Scaffolding

To change the scaffolding behaviour you can make config/models.php configuration file fit your database needs. Check it out ;-)

Tips

1. Keeping model changes

You may want to generate your models as often as you change your database. In order not to lose you own model changes, you should set base_files to true in your config/models.php.

When you enable this feature your models will inherit their base configurations from base models. You should avoid adding code to your base models, since you will lose all changes when they are generated again.

Note: You will end up with two models for the same table and you may think it is a horrible idea to have two classes for the same thing. However, it is up to you to decide whether this approach gives value to your project :-)

Support

For the time being, this package only supports MySQL databases. Support for other databases will be added soon.

You can’t perform that action at this time.