Skip to content

Commit

Permalink
[7.x] Add blade attribute method whereDoesNotStartsWith(string) (#3…
Browse files Browse the repository at this point in the history
…3851)

* Add method whereDoesNotStartsWith(string)

This change adds a method `whereDoesNotStartsWith($string)` which complements the `whereStartsWith($string)`

* Update ComponentAttributeBag.php

Co-authored-by: Taylor Otwell <taylor@laravel.com>
  • Loading branch information
bilfeldt and taylorotwell committed Aug 13, 2020
1 parent 5682bdb commit f0572ff
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Illuminate/View/ComponentAttributeBag.php
Expand Up @@ -117,6 +117,19 @@ public function whereStartsWith($string)
return Str::startsWith($key, $string);
});
}

/**
* Return a bag of attributes with keys that do not start with the given value / pattern.
*
* @param string $string
* @return static
*/
public function whereDoesntStartWith($string)
{
return $this->reject(function ($value, $key) use ($string) {
return Str::startsWith($key, $string);
});
}

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

0 comments on commit f0572ff

Please sign in to comment.