diplodocker / comments-loader
Laravel 表注释加载器(Diplodocker 项目的一部分)
0.0.2
2022-10-11 13:12 UTC
Requires
- php: ^7.1.3
Requires (Dev)
- slevomat/coding-standard: dev-master
This package is auto-updated.
Last update: 2024-09-11 18:06:02 UTC
README
为什么我应该使用这个包?
安装
- 安装 laravel =)
composer require --dev diplodocker/comments-loader
Lumen 提供者设置
bootstrap/app.php
$app->register(Diplodocker\Providers\CommentsLoaderProvider::class);
在迁移中使用(MySQL 或 Postgres)
/** * Run the migrations. * * @return void */ public function up() { Schema::create('test', function (Blueprint $table) { $table->bigIncrements('id'); $table->nullableTimestamps(); $table->tableComment('its sample table comment'); }); // or change on existing table Schema::table('test', function(Blueprint $table) { $table->tableComment('its changed comment'); }); }
或使用类(仅限 MySQL)
<?php use Diplodocker\CommentsLoaderMigration; class SomeMigrationFileName extends CommentsLoaderMigration { public $comments = [ 'users' => 'Users table', 'documents' => 'Documents table', ... ];
或使用特性
<?php use Diplodocker\Concerns\CommentsLoader; use Illuminate\Database\Migrations\Migration; class SomeMigrationFileName extends Migration { // use trait use CommentsLoader; public $comments = [ 'users' => 'Users table', 'documents' => 'Documents table', ... ]; /** * Run the migrations. * * @return void */ public function up() { // your code here $this->loadTableComments(); } /** * Reverse the migrations. * * @return void */ public function down() { // your code here }