How to Use is() Method in Laravel

Hello Artisan, in this tutorial i will help you that how can you use is() method in Laravel. Do you know you can check to data whather both of them same or not. If same then it will return true. So we can say that the is method determines if a given string matches a given pattern. Asterisks may be used as wildcard values.

See the below code as an example:

use Illuminate\Support\Str;

$matches = Str::of('foobar')->is('foo*');

// true

$matches = Str::of('foobar')->is('baz*');

// false


Hope it can help you.