kingdarkness / k-repository
generator repository laravel 5.*
Installs: 1 039
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=5.6.4
- laravel/framework: 5.5.*
This package is auto-updated.
Last update: 2024-11-29 05:20:53 UTC
README
generator repository laravel 5.*
Install
$ composer require kingdarkness/k-repository
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