Skip to content

daolvcntt/generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

k-repository

generator repository laravel 5.*

Install

$ composer require daolvcntt/generator

Edit your AppServiceProvider to add the following to the register method:

$this->app->register(\KRepository\KRepositoryServiceProvider::class);
if (!empty(config('kproviders'))) {
    foreach (config('kproviders') as $provider )
    {
        $this->app->register( $provider );
    }
}

Then execute the command:

$ php artisan vendor:publish  --provider="KRepository\KRepositoryServiceProvider"

Edit config/krepository.php to your needs.

Example config

return [
    'path' => 'King',
    'files' => [
        'model' => '{name}',
        'interface' => '{name}Repository',
        'data_mapper' => 'Db{name}Repository'
    ],
    'parent' => [
        // data mapper parent class configs
        'data_mapper' => [
            'config' => true,
            'class_name' => 'BaseRepository',
            'namespace' => 'Darkness\King'
        ],
        'model' => [
            'config' => true,
            'class_name' => 'Entity',
            'namespace' => 'Darkness\King'
        ]
    ]
];

To create a simple repository:

$ php artisan make:repository User

To create a repository with migration:

$ php artisan make:repository User --migration=true

The repository will generator in app/King/Users

The migration in database/migrations

The ServiceProvider in app/Providers

The repository will automatic register ServiceProvider in configs/kproviders.php

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages