We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e81d059 commit cf1e6c9Copy full SHA for cf1e6c9
src/Providers/EloquentProvider.php
@@ -15,6 +15,13 @@ abstract class EloquentProvider extends Provider
15
* Eloquent model.
16
*/
17
protected $model;
18
+
19
+ /**
20
+ * Cached items.
21
+ *
22
+ * @var Collection
23
+ */
24
+ protected static $items;
25
26
/**
27
* Provides a collection of Navigable elements.
@@ -23,11 +30,15 @@ abstract class EloquentProvider extends Provider
30
31
protected function navigable()
32
{
- return $this->repository()
- ->get()
28
- ->map(function ($item) {
29
- return new Eloquent($item);
- }, []);
33
+ if (null === static::$items) {
34
+ static::$items = $this->repository()
35
+ ->get()
36
+ ->map(function ($item) {
37
+ return new Eloquent($item);
38
+ }, []);
39
+ }
40
41
+ return static::$items;
42
}
43
44
0 commit comments