JannatKhan
1 month ago
124
2
Laravel

How to return laravel migration table?

Posted 1 month ago by JannatKhan

I wonder if there is a way that I can access the Blueprint in migration file and return it in a external file. Example, I have the following USERS migration:

    Schema::create('users', function (Blueprint $table) {
        $table->increments('id');
        $table->string('name');
        $table->string('email')->unique();
        $table->timestamp('email_verified_at')->nullable();
        $table->string('password');
        $table->rememberToken();
        $table->timestamps();
    });

So I wonder if I could "access" this object to use it in a external file. Imagine I have a file get_data_from_migration.blade.php and I could do something like:

use Illuminate\Database\Migrations\Migration;

$table = Migration('migrationName');
var_dump($table);

So it would print the user table Blueprint on the screen. I know it would not be the correct sintax but I use it only to ilustrate the idea.

Anyway, what I need is to print on the screen something like:

You colums in the table are:

id name email email_verified_at password

Thank you

Please sign in or create an account to participate in this conversation.