Skip to content

Commit

Permalink
Has meta function
Browse files Browse the repository at this point in the history
  • Loading branch information
ovanschie committed Aug 21, 2017
1 parent cb1dba8 commit 79f98ed
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ $book->addMeta('someKey', 'someValue');

$book->getMeta('someKey');

$book->hasMeta('someKey');

$book->updateMeta('someKey', 'anotherValue');

$book->deleteMeta('someKey');
Expand Down
13 changes: 13 additions & 0 deletions src/Metable.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@ public function getAllMeta()
return collect($this->meta->pluck('value', 'key'));
}

/**
* Has meta.
*
* @param string $key
* @return bool
*/
public function hasMeta($key)
{
$meta = $this->meta()->where('key', $key)->get();

return (bool) count($meta);
}

/**
* Get meta.
*
Expand Down

0 comments on commit 79f98ed

Please sign in to comment.