diff --git a/src/Traits/Kabsa.php b/src/Traits/Kabsa.php index f7d0ddd..44e2fe5 100755 --- a/src/Traits/Kabsa.php +++ b/src/Traits/Kabsa.php @@ -7,6 +7,8 @@ trait Kabsa { + static $kabsaCollection; + public function getRows() { return $this->rows; @@ -14,10 +16,14 @@ public function getRows() public static function all($columns = []) { + if(!empty(static::$kabsaCollection)) { + return static::$kabsaCollection; + } + self::unguard(); $self = new self(); - return Collection::make($self->getRows() ?? [])->map(function ($row) { return new self($row); }); + return static::$kabsaCollection = Collection::make($self->getRows() ?? [])->map(function ($row) { return new self($row); }); } public function __call($method, $parameters)