Skip to content

Commit

Permalink
Prevent making addon instances multiple times
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonvarga committed Oct 28, 2020
1 parent 3b08793 commit d4ce470
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Extend/AddonRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

class AddonRepository
{
protected $addons;

/**
* Make an addon instance.
*
Expand All @@ -25,7 +27,7 @@ public function make($addon)
*/
public function all()
{
return app(Manifest::class)->addons()->map(function ($addon) {
return $this->addons = $this->addons ?? app(Manifest::class)->addons()->map(function ($addon) {
return $this->make($addon);
});
}
Expand All @@ -37,8 +39,6 @@ public function all()
*/
public function get($id)
{
return $this->make(
app(Manifest::class)->addons()->get($id)
);
return $this->all()->get($id);
}
}

0 comments on commit d4ce470

Please sign in to comment.