💬Table comments loader for Laravel
composer require --dev diplodocker/comments-loader
bootstrap/app.php
$app->register(Diplodocker\Providers\CommentsLoaderProvider::class);
/**
* 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');
});
}
<?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
}