How to create schema table datatype longtext?

You need to simple write datatype long text in place of string

Schema::table('table name ', function (Blueprint $table) {
        $table->longText('attachments');
});

I have this work for you.

for more details go through the link https://laravel.com/docs/4.2/schema


Laravel 4.2 / 5.1+

Simply use the recently added longText method.

Schema::create('posts', function ($table) {
    $table->increments('id');
    $table->integer('user_id');
    // ...
    $table->longText('description');
    // ...
}

Pre-Laravel 4.2 / 5.1

There is no way of doing that with the regular Laravel Schema classes, since it does not implement such type. If you really need it, you could use the Schema class to create the table, and then alter the table using a SQL query to add this field. For instance, you could have:

Schema::create('posts', function ($table) {
    $table->increments('id');
    $table->integer('user_id');
    // ...
    $table->text('description');
    // ...
}

DB::statement('ALTER TABLE `posts` COLUMN `description` `description` LONGTEXT;');

It's available now. From the docs

$table->longText('description');