Looking to hire Laravel developers? Try LaraJobs

laravel-artisan-commands maintained by rhaarhoff

Description
Useful Artisan commands for generating services, repositories and more.
Author
Last update
2019/05/27 09:22 (dev-master)
License
Links
Downloads
19
Tags

Comments
comments powered by Disqus

Laravel 5 Custom Artisan Commands

Latest Stable Version Software License Total Stars Total Downloads

Description

This package provides some useful Artisan commands for generating services, repositories and more.

Installation

Require this package with Composer using the following command:

composer require rhaarhoff/laravel-artisan-commands

After updating Composer, add the service provider to the providers array in config/app.php:

Rhaarhoff\LaravelArtisanCommands\CommandServiceProvider::class

Run the dump-autoload command:

composer dump-autoload

In Laravel, instead of adding the service provider in the config/app.php file, you can add the following code to your app/Providers/AppServiceProvider.php file, within the register() method:

public function register()
{
    if ($this->app->environment() !== 'production') {
        $this->app->register(\Rhaarhoff\LaravelArtisanCommands\CommandServiceProvider::class);
    }
    // ...
}

Commands

Below you can find all the commands that you can use, including the parameters that you can specify.

COMMAND                     PARAMETER             DESCRIPTION
-----------------------------------------------------------------------------------------------------------------------
make:service <name>                               Generates a basic service class
make:service <name>         -m <model>            Generates a basic service class as well as a model
make:service <name>         -c                    Generates a service class with a constructor
make:service <name>         -y <repository>       Generates a service class as well as a repository
make:repository <name>                            Generates a basic repository class
make:repository <name>      -m <model>            Generates a repository class as well as a model
make:layer <name>                                 Generates only a model class if no parameters are specified
make:layer <name>           -c                    Generates a new controller class for the model
make:layer <name>           -s                    Generates a new service class for the model
make:layer <name>           -y                    Generates a new repository class for the model
make:layer <name>           -f                    Generates a new factory class for the model
make:layer <name>           -m                    Generates a new migration for the model
make:layer <name>           -p                    Indicates if the model should be a custom intermediate table model
make:layer <name>           -r                    Indicates if the generated controller should be a resource controller
make:layer <name>           -all                  Generates a migration, factory, resource controller, service
                                                  and repository for the model

License

The Laravel Artisan Commands is open-sourced software licensed under the MIT license.