How to create laravel json and jsonb type migration

How to make laravel json() migration. save json type data in json datatype column. laravel jsonb migration

Laravel json datatype migration

Laravel migration json() method create JSON equivalent column which is longtext datatype column. we store json encoded data in this type of column.

public function up()
{
    Schema::create('users', function (Blueprint $table) {
        $table->json('payload');
    });
}

Laravel jsonb migration

Laravel migration jsonb() method create JSONB equivalent column which is also longtext datatype column.

public function up()
{
    Schema::create('users', function (Blueprint $table) {
        $table->JSONB('payload');
    });
}
php laravel developer anmol sharma

Anmol Sharma

I am a software engineer and have experience in web development technologies like php, Laravel, Codeigniter, javascript, jquery, bootstrap and I like to share my deep knowledge by these blogs.

Random tutorial links