laravel-repository-maker maintained by tarre
Description
Because your controllers should be controllers.
Author
Last update
2019/09/08 10:28
(dev-master)
License
Downloads
100
Was is das
Repository pattern made easy.
Installation
composer require tarre/laravel-repository-maker --devphp artisan vendor:publish --tag=laravel-repository-maker --force- Open
app/Providers/AppServiceProvider.phpdo step 4 and 5. - Wrap
\\ USES-STARTand\\USES-ENDaround theuse Illuminate\Support\ServiceProvider(and or) otheruse-keywords - Add
\\ USES-STARTand\\USES-ENDunder anywhere in the register method.
Example of end result
<?php
namespace App\Providers;
// USES-START
use Illuminate\Support\ServiceProvider;
// USES-STOP
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
//
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
// REGISTER-START
// REGISTER-STOP
}
}
How to use
php artisan make:repository <name> <modelName?>
Switches
--controllercreates an associated controller with the repository.--route=web/apicreates an associatedroute::Resourceentry.
FYI
if <modelName> is not given, a plain template will be used. if you want to create an associated controller: use the --controller switch
FAQ
Q: Nothing happends when i try to run the command
A: Then your version of laravel probably does not support package discovery, add Tarre\RepositoryMaker\ServiceProvider::class to your config\app.php
Q: I want to change X / Where can i change the templates?
A: Change that settings in config\laravel-repository-maker.php. Templates are located in resources\laravel-orm-maker and can be modified freely.