'Unable to alter table in using route in Laravel 8

I have a migration in Laravel 8 and already migrate. I was trying to alter the table and make nullable to one of the fields on that table.

I have run the following command

composer require doctrine/dbal  

Here are the code I have in my web.php

Route::get('/update-column', function() 
{
    \Schema::table('kunjungan', function (Blueprint $table) {
        $table->string('laporan')->nullable()->change();
    });
});

When I tried to run that route from my browser, it ends up with the following error:

TypeError
Illuminate\Routing\RouteFileRegistrar::{closure}(): Argument #1 ($table) must be of type Blueprint, Illuminate\Database\Schema\Blueprint given, called in /Users/gmaramis/Documents/WebProjects/SiGER/SiGER-Kairos/vendor/laravel/framework/src/Illuminate/Database/Schema/Blueprint.php on line 95

What am I supposed to do to fix that error?

I am pretty newbie in Laravel

Thank you so much..



Solution 1:[1]

You are not importing the Blueprint class.

Add the following import to your file that's using Schema::table()

use Illuminate\Database\Schema\Blueprint;

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Elias Soares