For laravel 7.x to create a nullable foreign key use simply:
$table->foreignId('country_id')->nullable()->constrained();$table->foreignId('state_id')->nullable()->constrained();
REMEMBER: nullable should be before constrained otherwise the nullable will not be affected.