ahmed-aliraqi/artisan-scaffolding
Composer 安装命令:
composer require ahmed-aliraqi/artisan-scaffolding
包简介
README 文档
README
This package adds some artisan commands to generate relations, helpers, scopes, concerns, mutators, transformers files and override the laravel original artisan commands as your like.
NOTE : the view artisan commands was forked from sven/artisan-view
Installation
Via composer:
composer require ahmed-aliraqi/artisan-scaffolding
Or add the package to your dependencies in composer.json and run
composer update to download the package:
{
"require": {
"ahmed-aliraqi/artisan-scaffolding": "^1.0"
}
}
Note: If you're using Laravel 5.5, you're done! The service provider is automatically registered in the container, thanks to auto-discovery.
Next, add the ServiceProvider to your providers array in config/app.php:
// config/app.php 'providers' => [ ... Aliraqi\Artisan\Scaffolding\Providers\ServiceProvider::class, ];
Usage
If you now run php artisan you can see 8 new commands:
make:helpermake:mutatormake:relationmake:scopemake:concernmake:transformermake:viewscrap:view
These commands was overrided by this package :
make:model: add the fillable as default.make:controller: add generate request option and generate full resource, nested controller .make:policy: addlistingmethod and replace theuservariable name toautherif the created policy file name is usermake:request: division the rules by method name and change theauthorizemethod return to true by default.
If you want to change your project character run this command to publish the config file :
php artisan vendor:publish --provider=Aliraqi\Artisan\Scaffolding\Providers\ServiceProvider --tag=config
// config/artisan-scaffolding.php
<?php
return [
/**
* the default namespace for the models classes.
*
* if you change the default namespace you need to change user model namespace in these files :-
* - config/auth.php
* - config/services.php
* - app/Http/Controllers/Auth/RegisterController.php
* - database/factories/ModelFactory.php
*
*/
'models_default_namespace' => 'App',
/**
* the default namespace for the relations traits.
*
*/
'relations_default_namespace' => 'App\Relations',
/**
* the default namespace for the concerns traits.
*
*/
'concerns_default_namespace' => 'App\Concerns',
/**
* the default namespace for the mutators traits.
*
*/
'mutators_default_namespace' => 'App\Mutators',
/**
* the default namespace for the scopes traits.
*
*/
'scopes_default_namespace' => 'App\Scopes',
/**
* the default namespace for the helpers traits.
*
*/
'helpers_default_namespace' => 'App\Helpers',
/**
* the default namespace for the policies classes.
*
*/
'policies_default_namespace' => 'App\Policies',
/**
* the default namespace for the requests classes.
*
*/
'requests_default_namespace' => 'App\Http\Requests',
/**
* the default namespace for the controllers classes.
*
*/
'controllers_default_namespace' => 'App\Http\Controllers',
/**
* the default namespace for the transformer classes.
*
*/
'transformers_default_namespace' => 'App\Transformers',
];
If you want to change stubs files content run this command :
php artisan vendor:publish --provider=Aliraqi\Artisan\Scaffolding\Providers\ServiceProvider --tag=stubs
Now you can see the stubs files in this path app\Console\stubs
License
sven/artisan-view is licensed under the MIT License (MIT). Please see the
license file for more information.
统计信息
- 总下载量: 49
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-07-15