javascript - Laravel: give longText field a default value

one text

Solution:

As stated in the comments, mysql has limitations around defaults and texts. Instead you can set it through code. Before anything is saved to the database, the creating event is triggered. You can hook into this and set the default value on the model using the boot function.

class YourModel
{
    protected static function boot()
    {
        parent::boot();

        static::creating(function ($model) {
            $model->body = '<body></body>';
        });
    }
}

This can also be done through observers, which is a little more comprehensive. Avoids doing to much logic in the boot method(), which quickly can become crowded.

Source