Skip to content

Commit d4ce470

Browse files
committed
Prevent making addon instances multiple times
1 parent 3b08793 commit d4ce470

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Extend/AddonRepository.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
class AddonRepository
66
{
7+
protected $addons;
8+
79
/**
810
* Make an addon instance.
911
*
@@ -25,7 +27,7 @@ public function make($addon)
2527
*/
2628
public function all()
2729
{
28-
return app(Manifest::class)->addons()->map(function ($addon) {
30+
return $this->addons = $this->addons ?? app(Manifest::class)->addons()->map(function ($addon) {
2931
return $this->make($addon);
3032
});
3133
}
@@ -37,8 +39,6 @@ public function all()
3739
*/
3840
public function get($id)
3941
{
40-
return $this->make(
41-
app(Manifest::class)->addons()->get($id)
42-
);
42+
return $this->all()->get($id);
4343
}
4444
}

0 commit comments

Comments
 (0)