Ad

How To Use Data Type As "blob" During Migration In Laravel 6

- 1 answer

I want to store HTML in the database as blob data type when I try to migrate getting errors

Schema::create('projects', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('project_name');
            $table->blob('project_description');
            $table->timestamps();
        });
    }
php artisan module:migrate projects
Migrating: 2019_10_17_125423_create_projects_table

BadMethodCallException : Method Illuminate\Database\Schema\Blueprint::blob does not exist.

at xampp\htdocs\minidmsapi\vendor\laravel\framework\src\Illuminate\Support\Traits\Macroable.php:104

Ad

Answer

In Laravel they have binary instead of blob. binary is equivalent to blob.

You can use it like:

$table->binary('name'); 

For more information see docs.

Thanks

Ad
source: stackoverflow.com
Ad