PHP code example of diplodocker / comments-loader

1. Go to this page and download the library: Download diplodocker/comments-loader library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

diplodocker / comments-loader example snippets


$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');
    });
}



use Diplodocker\CommentsLoaderMigration;

class SomeMigrationFileName extends CommentsLoaderMigration
{
    public $comments = [
        'users' => 'Users table',
        'documents' => 'Documents table',
        ...
    ];




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
    }