@@ 33-44 (lines=12) @@ | ||
30 | * @param string $path |
|
31 | * @param null $label |
|
32 | */ |
|
33 | public function __construct($path, $label = null) |
|
34 | { |
|
35 | parent::__construct($path, $label); |
|
36 | ||
37 | $this->setLoadOptionsQueryPreparer(function ($item, Builder $query) { |
|
38 | $repository = app(RepositoryInterface::class); |
|
39 | $repository->setModel($this->getModelForOptions()); |
|
40 | $key = $repository->getModel()->getKeyName(); |
|
41 | ||
42 | return $query->whereIn($key, $this->getValueFromModel() ? $this->getValueFromModel() : []); |
|
43 | }); |
|
44 | } |
|
45 | ||
46 | /** |
|
47 | * @return null |
@@ 22-33 (lines=12) @@ | ||
19 | * @param string $path |
|
20 | * @param string|null $label |
|
21 | */ |
|
22 | public function __construct($path, $label = null) |
|
23 | { |
|
24 | parent::__construct($path, $label); |
|
25 | ||
26 | $this->setLoadOptionsQueryPreparer(function ($item, Builder $query) { |
|
27 | $repository = app(RepositoryInterface::class); |
|
28 | $repository->setModel($this->getModelForOptions()); |
|
29 | $key = $repository->getModel()->getKeyName(); |
|
30 | ||
31 | return $query->where([$key => $this->getValueFromModel()]); |
|
32 | }); |
|
33 | } |
|
34 | ||
35 | /** |
|
36 | * @param Router $router |