Laravel More Command is a collection of a few php artisan
commands. You can use it to create a Repository, Repository with Interface, Service, Trait, View(blade file), and Clear Log from the command line using php artisan
command.
[Note : This package also worked for nWidart/laravel-modules]
Require the package with composer using the following command:
composer require theanik/laravel-more-command --dev
Or add the following to your composer.json's require-dev section and composer update
"require-dev": {
"theanik/laravel-more-command": "^1.3.0"
}
php artisan vendor:publish --provider="Theanik\LaravelMoreCommand\LaravelMoreCommandProvider" --tag="config"
<?php
return [
'repository-namespace' => 'App', // Your Desire Namespace for Repository Classes
'service-namespace' => 'App', // Your Desire Namespace for Service Classes
];
Create a repository Class.
php artisan make:repository your-repository-name
Example:
php artisan make:repository UserRepository
or
php artisan make:repository Backend/UserRepository
The above will create a Repositories directory inside the App directory.\
Create a repository with Interface.
php artisan make:repository your-repository-name -i
Example:
php artisan make:repository UserRepository -i
or
php artisan make:repository Backend/UserRepository -i
Here you need to put extra -i
flag.
The above will create a Repositories directory inside the App directory.
In nWidart/laravel-modules Modules
Create a repository Class.
php artisan module:make-repository your-repository-name {module-name}
Example:
php artisan module:make-repository UserRepository Blog
or
php artisan module:make-repository Backend/UserRepository Blog
The above will create a Repositories directory inside the {Module} directory.
Create a repository with Interface.
php artisan module:make-repository your-repository-name {module-name} -i
Example:
php artisan module:make-repository UserRepository -i Blog
or
php artisan module:make-repository Backend/UserRepository -i Blog
Here you need to put extra -i
flag.
The above will create a Repositories directory inside the {Module} directory.
\
An Example of created repository class:
<?php
namespace App\Repositories;
class UserRepository
{
public function __constuct()
{
//
}
}
Create a Service Class.
php artisan make:service your-service-name
Example:
php artisan make:service UserService
or
php artisan make:service Backend/UserService
The above will create a Services directory inside the App directory.
In nWidart/laravel-modules Modules
php artisan module:make-service your-service-name {module-name}
Example:
php artisan module:make-service UserService
or
php artisan module:make-service Backend/UserService
The above will create a Services directory inside the {Module} directory.
Create a Trait.
php artisan make:trait your-trait-name
Example:
php artisan make:trait HasAuth
or
php artisan make:trait Backend/HasAuth
The above will create a Traits directory inside the App directory.
In nWidart/laravel-modules Modules
php artisan module:make-trait your-trait-name {module-name}
Example:
php artisan module:make-trait HasAuth
or
php artisan module:make-trait Backend/HasAuth
The above will create a Traits directory inside the {Module} directory.
Create a view.
php artisan make:view your-view-file-name
Example:
php artisan make:view index
or
php artisan make:view user/index
The above will create a blade file inside the /resource/views/ directory.
In nWidart/laravel-modules Modules
php artisan module:make-view your-view-file-name {module-name}
Example:
php artisan module:make-view index
or
php artisan module:make-view user/index
The above will create a blade file inside the {Module}/Resources/views/ directory.
php artisan log:clear
The above will deleted all old log data from /storage/logs/ directory.
The MIT License (MIT). Please see License for more information.