How do you store the wysiwyg in the Database?

Published 3 weeks ago by GTHell

Do I need to just create table with only 3 column?

  1. for id
  2. the HTML of wysiwyg
  3. Timestamp

No user since this is a company page.

Drfraker

Create a migration for the table:

<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateSomeContentTable extends Migration {

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('some_content', function(Blueprint $table) {
            $table->increments('id');
            $table->longText('wysiwyg_text');
            $table->timestamps();
        });
    }


    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('some_content');
    }

}

Store the content from the wysiwyg editor in the wysiwyg_text column.

Emtized

Hi Depends on how many pages you have if you have more than one page and you are using this wysiwyg editor in many pages you will need another field for page id or page name

GTHell

I want to have it in a different pages. I have no clues how to implement them. For now, I want to implement to News page and give the admin able to edit it with Rich text. I don't know if Rich text or normal text field is better choice.

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