beenet/plugin-maker

为 Laravel 制作插件

v1.51 2020-09-22 05:50 UTC

This package is auto-updated.

Last update: 2024-09-24 19:00:17 UTC


README

Laravel 7,8

Laravel 插件是一种软件组件,可以为现有应用程序添加特定功能。本包为后端和前端创建新的控制器、模型、请求和视图。创建新插件只需一个命令(make:plugin),最终将得到以下文件结构

.
└── app
    └── Http
        └── Controllers
            └── Backend
                ├── <Plugin>Controller.php
        └── Modules
            ├── <Plugin>.php
        └── Requests
            └── Backend
                ├── <Plugin>Request.php
└── database
    └── migrations
        ├── create_<Plugin>_table.php
    └── seeds
        ├── <Plugin>Seeder.php
└── resources
    └── views
        └── backend
            └── <plugin>
                ├── create.blade.php
                ├── edit.blade.php
                ├── form.blade.php
                ├── index.blade.php
        └── frontend
            └── <plugin>
                ├── index.blade.php
                ├── view.blade.php

安装

首先使用 composer 安装包

$ composer require beenet/plugin-maker
$ composer dump-autoload

将服务提供者添加到 config/app.php 配置文件中

'providers' => [
    ...
    Beenet\PluginMaker\PluginMakerServiceProvider::class,
],

插件类型:sile、order、letter

使用

安装模块

$ php artisan make:plugin [pluginName] [type]
$ composer dump-autoload
$ php artisan route:cache
$ php artisan migrate
$ php artisan db:seed --class=<Plugin>PluginSeeder