There comes a time when you would be in need of obfuscating a certain part of the string. For instance, to obfuscate the credit card’s digits except the last four or to mask specific parts of the phone number or email. The best way to do obfuscate/mask is by replacing the intended part of the string with the stars.
So, according to https://github.com/laravel/framework/pull/39393, this method mask() lets you mask a portion of a string with a repeated character like so.