I need some help. Example:
$table->text('description');
But, how to code/write, if I want my datatype is 'LONGTEXT' ?
I unable to find documentation on this @ http://laravel.com/docs/schema
Thanks!
Simply use the recently added longText
method.
Schema::create('posts', function ($table) {
$table->increments('id');
$table->integer('user_id');
// ...
$table->longText('description');
// ...
}
There is no way of doing that with the regular Laravel Schema classes, since it does not implement such type. If you really need it, you could use the Schema class to create the table, and then alter the table using a SQL query to add this field. For instance, you could have:
Schema::create('posts', function ($table) {
$table->increments('id');
$table->integer('user_id');
// ...
$table->text('description');
// ...
}
DB::statement('ALTER TABLE `posts` COLUMN `description` `description` LONGTEXT;');
Schema::table('table_namae', function (Blueprint $table) {
$table->longText('column_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