File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -322,6 +322,16 @@ public function isJson()
322
322
return Str::isJson ($ this ->value );
323
323
}
324
324
325
+ /**
326
+ * Determine if a given value is a valid URL.
327
+ *
328
+ * @return bool
329
+ */
330
+ public function isUrl ()
331
+ {
332
+ return Str::isUrl ($ this ->value );
333
+ }
334
+
325
335
/**
326
336
* Determine if a given string is a valid UUID.
327
337
*
Original file line number Diff line number Diff line change @@ -33,6 +33,12 @@ public function testIsAscii()
33
33
$ this ->assertFalse ($ this ->stringable ('ù ' )->isAscii ());
34
34
}
35
35
36
+ public function testIsUrl ()
37
+ {
38
+ $ this ->assertTrue ($ this ->stringable ('https://laravel.com ' )->isUrl ());
39
+ $ this ->assertFalse ($ this ->stringable ('invalid url ' )->isUrl ());
40
+ }
41
+
36
42
public function testIsUuid ()
37
43
{
38
44
$ this ->assertTrue ($ this ->stringable ('2cdc7039-65a6-4ac7-8e5d-d554a98e7b15 ' )->isUuid ());
You can’t perform that action at this time.
0 commit comments