I have searched all over the web for a tutorial on varchar max. I have even tried
$table->string('name', "MAX");
This gives me an error.
How can I set up varchar max for a blog post for a laravel project. Thanks
There is no "max" constant for VARCHAR in MySQL. Instead you need to define the maximum value of the field yourself.
In order to define max length for a text field just provide max length limit as second parameter:
$table->string('name', 64);
It will result in a VARCHAR column being created in your MySQL database. Keep in mind that if max length is very high, a field of different type might be created instead (mediumtext, longtext).
Use text for varchar(max):
$table->text('name');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With