Downloads
Stars
Version
Create Laravel repositories easily!
composer require alextigaer/rep-o-matic
To create a new repository, just run the command:
php artisan repo:create RepoName
This will create:
If you want, you can use these options to customize the creation:
This option allows to choose if the exceptions should be created. The default value is set to 'y'. Other values are not considered
Description:
{--e=y : Choose whether to create the exceptions, or not [y/n]}
Usage:
// Create the repo files excluding the exceptions
php artisan repo:create RepoName --e=n
This option allows to choose if the model should be created. The default value is set to 'y'. Other values are not considered
Description:
{--m=y : Choose whether to create the model, or not [y/n]}
Usage:
// Create the repo files excluding the model
php artisan repo:create RepoName --m=n
The option '--m-fillable' allows to add mass-assignable attributes to the model (and to the migration and the seeder too)
Description:
{--m-fillable=* : The mass-assignable attributes of the model}
Usage:
// 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
The option '--m-hidden' allows to add hidden attributes to the model (and to the migration and the seeder too)
Description:
{--m-hidden=* : The hidden attributes of the model}
Usage:
// Create the repo files and set 2 model hidden attributes: password and pin
php artisan repo:create RepoName --m-hidden=password --m-hidden=pin
This option allows to choose if the repository should be created. The default value is set to 'y'. Other values are not considered
Description:
{--r=y : Choose whether to create the repository, or not [y/n]}
Usage:
// Create the repo files excluding the 'Repositories' folder and its content
php artisan repo:create RepoName --m=n
This option allows to choose if the migration should be created. The default value is set to 'y'. Other values are not considered
Description:
{--n=y : Choose whether to create the migration, or not [y/n]}
Usage:
// Create the repo files excluding the migration
php artisan repo:create RepoName --n=n
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)
Description:
{--n-types=* : The columns types of the attributes (check Laravel doc for acceptable values)}
Usage:
// 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
This option allows to choose if the migrate command should be run. The default value is set to 'n'. Other values are not considered
Description:
{--migrate=n : Choose whether to run the command migrate, or not [y/n]}
Usage:
// Create the repo files and run the migration after its creation
php artisan repo:create RepoName --migrate=y
This option allows to choose if the seeder should be created. The default value is set to 'y'. Other values are not considered
Description:
{--s=y : Choose whether to create the seeder, or not [y/n]}
Usage:
// Create the repo files excluding the seeder
php artisan repo:create RepoName --s=n
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""'
Description:
{--s-instances=* : The values of the instances}
Usage:
// 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"
This option allows to choose if the seed command should be run. The default value is set to 'n'. Other values are not considered
Description:
{--seed=n : Choose whether to run the command db:seed, or not [y/n]}
Usage:
// Create the repo files and run the seeding procedure
php artisan repo:create RepoName --seed=y
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
php artisan repo:create ExampleTwo --m-hidden=hidden_1 --s-instances="passwordone" --s-instances="passwordtwo" --seed=y
Feel free to suggest anything! Use pulls or contact me :)
Rep-O-Matic is licensed under the MIT license. Made with love, let's share it! :)