Skip to content

Commit

Permalink
[8.x] Add has() method to ComponentAttributeBag (#35562)
Browse files Browse the repository at this point in the history
* Add has() method to ComponentAttributeBag

* Update ComponentAttributeBag.php

Co-authored-by: Taylor Otwell <taylor@laravel.com>
  • Loading branch information
ConsoleTVs and taylorotwell committed Dec 10, 2020
1 parent d1a023b commit da61279
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Illuminate/View/ComponentAttributeBag.php
Expand Up @@ -56,6 +56,17 @@ public function get($key, $default = null)
return $this->attributes[$key] ?? value($default);
}

/**
* Determine if a given attribute exists in the attribute array.
*
* @param string $key
* @return bool
*/
public function has($key)
{
return array_key_exists($key, $this->attributes);
}

/**
* Only include the given attribute from the attribute array.
*
Expand Down

0 comments on commit da61279

Please sign in to comment.