2017 © Pedro Peláez
 

library rep-o-matic

Create Laravel repositories easily!

image

alextigaer/rep-o-matic

Create Laravel repositories easily!

  • Monday, May 21, 2018
  • by alextigaer
  • Repository
  • 1 Watchers
  • 0 Stars
  • 65 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 7 % Grown

The README.md

Rep-O-Matic


Create Laravel repositories easily!, (*1)

Table of Contents

Installation

composer require alextigaer/rep-o-matic

Basic usage

To create a new repository, just run the command:, (*2)

php artisan repo:create RepoName

This will create: - 4 exceptions for the repository: 'RepoNameNotFoundException', 'RepoNameNotCreatedException', 'RepoNameNotUpdatedException' and 'RepoNameNotDeletedException' - The model file 'RepoName.php' inside the 'Models' directory - The 'Repositories' directory with 2 directories inside: 'Contracts' and 'RepoName'. The 'Contracts' directory will contain all the repositories' contracts. The 'RepoName' directory will contain all the repositories for 'RepoName'. The command will also bind the contract to the repository's file - The migration 'create_reponames_table' - The 'RepoNamesSeeder'. The command will also update the 'DatabaseSeeder' file, adding the line to call 'RepoNamesSeeder', (*3)

Options

If you want, you can use these options to customize the creation:, (*4)

--e (default=y)

This option allows to choose if the exceptions should be created. The default value is set to 'y'. Other values are not considered, (*5)

Description:, (*6)

{--e=y : Choose whether to create the exceptions, or not [y/n]}

Usage:, (*7)

// Create the repo files excluding the exceptions
php artisan repo:create RepoName --e=n

--m (default=y)

This option allows to choose if the model should be created. The default value is set to 'y'. Other values are not considered, (*8)

Description:, (*9)

{--m=y : Choose whether to create the model, or not [y/n]}

Usage:, (*10)

// Create the repo files excluding the model
php artisan repo:create RepoName --m=n

--m-fillable

The option '--m-fillable' allows to add mass-assignable attributes to the model (and to the migration and the seeder too), (*11)

Description:, (*12)

{--m-fillable=* : The mass-assignable attributes of the model}

Usage:, (*13)

// Create the repo files and set 2 model mass-assignable attributes: name and email
php artisan repo:create RepoName --m-fillable=name --m-fillable=email

--m-hidden

The option '--m-hidden' allows to add hidden attributes to the model (and to the migration and the seeder too), (*14)

Description:, (*15)

{--m-hidden=* : The hidden attributes of the model}

Usage:, (*16)

// Create the repo files and set 2 model hidden attributes: password and pin
php artisan repo:create RepoName --m-hidden=password --m-hidden=pin

--r (default=y)

This option allows to choose if the repository should be created. The default value is set to 'y'. Other values are not considered, (*17)

Description:, (*18)

{--r=y : Choose whether to create the repository, or not [y/n]}

Usage:, (*19)

// Create the repo files excluding the 'Repositories' folder and its content
php artisan repo:create RepoName --m=n

--n (default=y)

This option allows to choose if the migration should be created. The default value is set to 'y'. Other values are not considered, (*20)

Description:, (*21)

{--n=y : Choose whether to create the migration, or not [y/n]}

Usage:, (*22)

// Create the repo files excluding the migration
php artisan repo:create RepoName --n=n

--n-types

The option '--n-types' allows to add the types to the migration columns. If not specified, the command will assign the type 'string' to all of the columns (if --m-fillable and/or --m-hidden are used), (*23)

Description:, (*24)

{--n-types=* : The columns types of the attributes (check Laravel doc for acceptable values)}

Usage:, (*25)

// Create the repo files and set: 1 mass-assignable attribute (name), 1 hidden attribute (pin) and set the types of these 2 columns as 'string' and 'integer', respectively
php artisan repo:create RepoName --m-fillable=name --m-hidden=pin --n-types=string --n-types=integer

--migrate (default=n)

This option allows to choose if the migrate command should be run. The default value is set to 'n'. Other values are not considered, (*26)

Description:, (*27)

{--migrate=n : Choose whether to run the command migrate, or not [y/n]}

Usage:, (*28)

// Create the repo files and run the migration after its creation
php artisan repo:create RepoName --migrate=y

--s (default=y)

This option allows to choose if the seeder should be created. The default value is set to 'y'. Other values are not considered, (*29)

Description:, (*30)

{--s=y : Choose whether to create the seeder, or not [y/n]}

Usage:, (*31)

// Create the repo files excluding the seeder
php artisan repo:create RepoName --s=n

--s-instances

The option '--s-instances' allows to add some instances to the seeder. If not specified, the command will assign the value 'VALUE' to all of the columns (if --m-fillable and/or --m-hidden are used). A default separator for the values, the character ',', is set. The syntax to add an instance is: '--s-instances="value_1,value2,...,value_n""', (*32)

Description:, (*33)

{--s-instances=* : The values of the instances}

Usage:, (*34)

// Create the repo files and set: 1 mass-assignable attribute (name), 1 hidden attribute (pin) and create 2 instances of 'RepoName'
php artisan repo:create RepoName --m-fillable=name --m-hidden=pin --s-instances="Alex,1234" --s-instances="Georgia,4321"

--seed (default=n)

This option allows to choose if the seed command should be run. The default value is set to 'n'. Other values are not considered, (*35)

Description:, (*36)

{--seed=n : Choose whether to run the command db:seed, or not [y/n]}

Usage:, (*37)

// Create the repo files and run the seeding procedure
php artisan repo:create RepoName --seed=y

Usage examples

1) Create a repo called 'ExampleOne' with 3 mass-assignable attributes, 1 hidden attribute, column types set and without creating the seeder:, (*38)

php artisan repo:create ExampleOne --m-fillable=attr_1 --m-fillable=attr_2 --m-fillable=attr_2 --m-hidden=hidden_1 --n-types=string --n-types=integer --n-types=bigInteger --n-types=geometry --s=n

2) Create a repo called 'ExampleTwo' without mass-assignable attributes, 1 hidden attribute, 2 instances and run the seeding:, (*39)

php artisan repo:create ExampleTwo --m-hidden=hidden_1 --s-instances="passwordone" --s-instances="passwordtwo" --seed=y

Contributing

Feel free to suggest anything! Use pulls or contact me :), (*40)

License

Rep-O-Matic is licensed under the MIT license. Made with love, let's share it! :), (*41)

The Versions

21/05 2018

dev-master

9999999-dev https://github.com/alextigaer/rep-o-matic

Create Laravel repositories easily!

  Sources   Download

MIT

The Requires

 

by Alessio Vietri

laravel repositories rep-o-matic

19/05 2018

1.3.2

1.3.2.0 https://github.com/alextigaer/rep-o-matic

Create Laravel repositories easily!

  Sources   Download

MIT

The Requires

 

by Alessio Vietri

laravel repositories rep-o-matic

19/05 2018

1.3.1

1.3.1.0 https://github.com/alextigaer/rep-o-matic

Create Laravel repositories easily!

  Sources   Download

MIT

The Requires

 

by Alessio Vietri

laravel repositories rep-o-matic

19/05 2018

1.3

1.3.0.0 https://github.com/alextigaer/rep-o-matic

Create Laravel repositories easily!

  Sources   Download

MIT

The Requires

 

by Alessio Vietri

laravel repositories rep-o-matic

07/01 2018

1.2

1.2.0.0 https://github.com/alextigaer/rep-o-matic

Create Laravel repositories easily!

  Sources   Download

MIT

The Requires

 

by Alessio Vietri

laravel repositories rep-o-matic

01/01 2018

1.1.1

1.1.1.0 https://github.com/alextigaer/rep-o-matic

Create Laravel repositories easily!

  Sources   Download

MIT

The Requires

 

by Alessio Vietri

laravel repositories rep-o-matic

22/12 2017

1.1

1.1.0.0 https://github.com/alextigaer/rep-o-matic

Create Laravel repositories easily!

  Sources   Download

MIT

The Requires

 

by Alessio Vietri

laravel repositories rep-o-matic

19/12 2017

1.0

1.0.0.0 https://github.com/alextigaer/rep-o-matic

Create Laravel repositories easily!

  Sources   Download

MIT

The Requires

 

by Alessio Vietri

laravel repositories rep-o-matic