/** * Read Data Row * * @return array */ public function readDataRow() { $element = $this->collection->shift(); if (is_object($element) || !is_array($element)) { $element = $element->toArray(); } return $element; }
/** * to create a lot of wrapper by using models in Eloquent Collection * * @param \Illuminate\Support\Collection $collection * @param \Illuminate\Database\Eloquent\Model|int $wantedLang language id or specific language model * @param \Illuminate\Database\Eloquent\Model|int $defaultLang language id or specific language model * @return \Illuminate\Support\Collection */ protected function createWrappersInCollection(Collection $collection, $wantedLang, $defaultLang) { $newCollection = new EloquentColl(); $tempCollection = new EloquentColl($collection->all()); while (!$tempCollection->isEmpty()) { $newCollection->add($this->wrapper->createNew($tempCollection->shift(), $wantedLang, $defaultLang)); } return $newCollection; }