blob: b9b6616ef0377fa55558d032f3ffa295e0334e64 [file] [log] [blame]
Matthias Andreas Benkard7b2a3a12021-08-16 10:57:25 +02001<?php
2
3namespace Adldap\Query;
4
5use Adldap\Models\Model;
6use Illuminate\Support\Collection as BaseCollection;
7
8class Collection extends BaseCollection
9{
10 /**
11 * {@inheritdoc}
12 */
13 protected function valueRetriever($value)
14 {
15 if ($this->useAsCallable($value)) {
16 return $value;
17 }
18
19 return function ($item) use ($value) {
20 if ($item instanceof Model) {
21 return $item->getFirstAttribute($value);
22 }
23
24 return data_get($item, $value);
25 };
26 }
27}