Skip to content

Commit f0572ff

Browse files
[7.x] Add blade attribute method whereDoesNotStartsWith(string) (#33851)
* Add method whereDoesNotStartsWith(string) This change adds a method `whereDoesNotStartsWith($string)` which complements the `whereStartsWith($string)` * Update ComponentAttributeBag.php Co-authored-by: Taylor Otwell <[email protected]>
1 parent 5682bdb commit f0572ff

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/Illuminate/View/ComponentAttributeBag.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,19 @@ public function whereStartsWith($string)
117117
return Str::startsWith($key, $string);
118118
});
119119
}
120+
121+
/**
122+
* Return a bag of attributes with keys that do not start with the given value / pattern.
123+
*
124+
* @param string $string
125+
* @return static
126+
*/
127+
public function whereDoesntStartWith($string)
128+
{
129+
return $this->reject(function ($value, $key) use ($string) {
130+
return Str::startsWith($key, $string);
131+
});
132+
}
120133

121134
/**
122135
* Return a bag of attributes that have keys starting with the given value / pattern.

0 commit comments

Comments
 (0)