定制 ahmed-aliraqi/artisan-scaffolding 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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:helper
  • make:mutator
  • make:relation
  • make:scope
  • make:concern
  • make:transformer
  • make:view
  • scrap: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 : add listing method and replace the user variable name to auther if the created policy file name is user
  • make:request : division the rules by method name and change the authorize method 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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-07-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固