1 | <?php |
||
13 | class Repository |
||
14 | { |
||
15 | use Filters; |
||
16 | use IncludesRelations; |
||
17 | use Sorts; |
||
18 | |||
19 | const WITH_ALLOW_ALL = ['*']; |
||
20 | const WITH_ALLOW_NONE = []; |
||
21 | |||
22 | /** @var string */ |
||
23 | protected $model; |
||
24 | |||
25 | /** @var ResourceContext $resource_context */ |
||
26 | protected $resource_context; |
||
27 | |||
28 | /** @var array $allowed_with */ |
||
29 | protected $allowed_with = self::WITH_ALLOW_NONE; |
||
30 | |||
31 | /** @var array $default_with */ |
||
32 | protected $default_with = []; |
||
33 | |||
34 | /** @var string $default_sort_by */ |
||
35 | protected $default_sort_by; |
||
36 | |||
37 | /** @var string $default_sort_order */ |
||
38 | protected $default_sort_order = 'asc'; |
||
39 | |||
40 | public function __construct(ResourceContext $resource_context) |
||
44 | |||
45 | /** |
||
46 | * Creates a new repository for a model. |
||
47 | */ |
||
48 | public static function for(string $model, ResourceContext $context = null): self |
||
57 | |||
58 | /** |
||
59 | * Get the currenct resource context |
||
60 | */ |
||
61 | public function getContext(): ResourceContext |
||
65 | |||
66 | /** |
||
67 | * Set or replace the resource context |
||
68 | */ |
||
69 | public function setContext(ResourceContext $resource_context) |
||
75 | |||
76 | /** |
||
77 | * Set the model |
||
78 | */ |
||
79 | public function setModel(string $model) |
||
85 | |||
86 | /** |
||
87 | * Return all models based on resource context and query |
||
88 | * |
||
89 | * The ResourceContext determines if the result is a Collection or a |
||
90 | * Paginator. |
||
91 | * |
||
92 | * @return LengthAwarePaginator|Collection |
||
93 | */ |
||
94 | public function all($query = null) |
||
105 | |||
106 | /** |
||
107 | * Produces a result suitable for selects, lists, and autocomplete. All |
||
108 | * entries that has a 'value' and a 'label' key. |
||
109 | * |
||
110 | * Note: if a callable is used the mapping is performed in memory, while a |
||
111 | * string is done in the database layer. |
||
112 | * |
||
113 | * @param callable|string $column |
||
114 | * @param Builder $query |
||
115 | * @return Collection |
||
116 | */ |
||
117 | public function list($column = null, $query = null) |
||
138 | |||
139 | public function find($id, $query = null): Model |
||
151 | |||
152 | public function create(array $data): Model |
||
156 | |||
157 | public function update(Model $model, array $data): Model |
||
162 | |||
163 | public function destroy(Model $model) |
||
167 | |||
168 | protected function modelQuery($query = null) |
||
172 | |||
173 | protected function validateQurey(Builder $query) |
||
184 | |||
185 | /** |
||
186 | * @param Builder $query |
||
187 | * @return LengthAwarePaginator|Collection |
||
188 | */ |
||
189 | private function paginate($query) |
||
199 | } |
||
200 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.