Skip to content

Commit

Permalink
initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
fahedtms committed May 10, 2022
1 parent cf80c04 commit 3c310ae
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/HasExtraFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@

trait HasExtraFields
{

public function getExtras(): array
{
$extras = [];
foreach ($this->extraValues as $extraValue) {
$extras[$extraValue->extra->name] = $extraValue->value;
}

return $extras;
}

public function extras(): Collection
{
return $this->getExtraModelClassName()::where($this->getModelClassColumnName(), get_class($this))
Expand Down

0 comments on commit 3c310ae

Please sign in to comment.