Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between $table->string('some_text'); & $table->text('some_text'); in Laravel? [closed]

Tags:

php

laravel-5

What is the difference between:

$table->string('some_text');

and:

$table->text('some_text');

in Laravel?

Please, if you can be comprehensive. Thank you.

like image 222
Armando Perez Avatar asked Feb 14 '15 19:02

Armando Perez


1 Answers

As defined here:

$table->string() uses a VARCHAR equivalent

$table->text() uses a TEXT equivalent

(The actual types can depend on the database system)

The obvious difference is that VARCHAR has a specified length (default with string() is 255 characters) whereas TEXT doesn't have that.

Here is a comparison of the two types in MySQL

like image 73
lukasgeiter Avatar answered Sep 25 '22 08:09

lukasgeiter