コード例 #1
0
 /**
  * PlasticPaginator constructor.
  *
  * @param PlasticResult $result
  * @param int           $limit
  * @param int           $page
  */
 public function __construct(PlasticResult $result, $limit, $page)
 {
     $this->result = $result;
     parent::__construct($result->hits(), $result->totalHits(), $limit, $page, ['path' => LengthAwarePaginator::resolveCurrentPath()]);
     $hitsReference =& $this->items;
     $result->setHits($hitsReference);
 }
コード例 #2
0
ファイル: EloquentFiller.php プロジェクト: sleimanx2/plastic
 /**
  * Fill the results hists into Model.
  *
  * @param Model  $model
  * @param Result $result
  *
  * @return mixed|void
  */
 public function fill(Model $model, Result $result)
 {
     $hits = $result->hits()->map(function ($hit) use($model) {
         return $this->fillModel($model, $hit);
     });
     $result->setHits($hits);
 }