How to fix missing mediumText in Laravel 8

Viewed 90

When I run php artisan migrate command I got this error

Migrating: 2022_01_09_133840_create_posts_table

BadMethodCallException 

Method Illuminate\Database\Schema\Blueprint::mediumtText does not exist.

at C:\Users\Ali\Documents\workspace\firstproject\vendor\laravel\framework\src\Illuminate\Macroable\Traits\Macroable.php:113
109▕      */
110▕     public function __call($method, $parameters)
111▕     {
112▕         if (! static::hasMacro($method)) {
➜ 113▕             throw new BadMethodCallException(sprintf(
114▕                 'Method %s::%s does not exist.', static::class, $method
115▕             ));
116▕         }
117▕

• Bad Method Call: Did you mean Illuminate\Database\Schema\Blueprint::mediumText() ?

This is my code

public function up()
    {
        Schema::create('posts', function (Blueprint $table) {
            $table->increments('id');
            //$table->id();
            $table->string('title');
            $table->mediumtText('body');
            $table->timestamps();
        });
    }

I opened Laravel 8 documentation and I found mediumText is not deprecated

What should I do?

1 Answers

Check the difference between what you have given in the schema:

Illuminate\Database\Schema\Blueprint::mediumtText does not exist

and what they are suggesting instead:

Illuminate\Database\Schema\Blueprint::mediumText
Related