1

I have a Laravel app which manages articles. These articles have a content section, which is being stored within the database as string (varchar). It worked properly when I did not put in some big content, but now it says:

String data, right truncated: 1406 Data too long for column 'content' at row 1

How am I supposed to store the content in the database as HTML?

2 Answers 2

5

Laravel supports the text, mediumText and longText column types which resolve to the respective MySQL equivalent.

An appropriate migration entry for your instance would be:

$table->text('content');
Sign up to request clarification or add additional context in comments.

2 Comments

Perfect. I tottaly forgot about them although I used it in my older projects. Thanks
By the way, do not forget that text() field cannot be NULL, so nullable() will throw an exception.
2

You need to expand the size of the content column in the database. This means change the type from varchar to text.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.