VARCHAR max in laravel 5
Ad
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
Ad
Answer
Ad
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).
Ad
source: stackoverflow.com
Related Questions
Ad
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?
Ad