I can't add foreign key constraint in Laravel

You must follow the same datatype with unsigned for foreign key. By default laravel uses bigint so you must use unsignedBigInteger

Schema::create('chats', function (Blueprint $table) {
            $table->id();

            $table->unsignedBigInteger('from_id');
            $table->unsignedBigInteger('to_id');
            $table->text('message');

            $table->foreign('from_id')->references('id')->on('users');
            $table->foreign('to_id')->references('id')->on('users');

            $table->timestamps();
        });