1 | <?php |
||
10 | abstract class AbstractRepository |
||
11 | { |
||
12 | /** |
||
13 | * @var Container |
||
14 | */ |
||
15 | protected $app; |
||
16 | |||
17 | /** |
||
18 | * @var Model |
||
19 | */ |
||
20 | protected $model; |
||
21 | |||
22 | /** |
||
23 | * @var Builder |
||
24 | */ |
||
25 | protected $workingModel; |
||
26 | |||
27 | /** |
||
28 | * AbstractRepository constructor. |
||
29 | * |
||
30 | * @param Container $app |
||
31 | * @param Model $model |
||
32 | */ |
||
33 | public function __construct(Container $app, Model $model) |
||
38 | |||
39 | /** |
||
40 | * Find a model by its primary key. If none found, throw an exception |
||
41 | * |
||
42 | * @param mixed $id |
||
43 | * @param array $columns |
||
44 | * |
||
45 | * @return Collection|Model |
||
46 | */ |
||
47 | public function findOrFail($id, array $columns = ['*']) |
||
51 | |||
52 | /** |
||
53 | * Find a model by its primary key |
||
54 | * |
||
55 | * @param mixed $id |
||
56 | * @param array $columns |
||
57 | * |
||
58 | * @return Collection|Model |
||
59 | */ |
||
60 | public function find($id, array $columns = ['*']) |
||
64 | |||
65 | /** |
||
66 | * Get model |
||
67 | * |
||
68 | * @return Model |
||
69 | */ |
||
70 | protected function getModel() |
||
74 | |||
75 | /** |
||
76 | * Create a new instance of model |
||
77 | * |
||
78 | * @param array $attributes |
||
79 | * |
||
80 | * @return Model |
||
81 | */ |
||
82 | public function newInstance(array $attributes = []) |
||
86 | |||
87 | /** |
||
88 | * Save a new model and return the instance. |
||
89 | * |
||
90 | * @param array $attributes |
||
91 | * |
||
92 | * @return Model |
||
93 | */ |
||
94 | public function create(array $attributes = []) |
||
98 | |||
99 | /** |
||
100 | * Save a new model and return the instance. Allow mass-assignment. |
||
101 | * |
||
102 | * @param array $attributes |
||
103 | * |
||
104 | * @return Model |
||
105 | */ |
||
106 | public function forceCreate(array $attributes = []) |
||
110 | |||
111 | /** |
||
112 | * Destroy the models for the given primary keys. |
||
113 | * |
||
114 | * @param array|int $ids |
||
115 | * |
||
116 | * @return bool |
||
117 | */ |
||
118 | public function destroy($ids) |
||
122 | |||
123 | /** |
||
124 | * Sets working model |
||
125 | * |
||
126 | * @param Builder $model |
||
127 | */ |
||
128 | public function setWorkingModel(Builder $model) |
||
132 | |||
133 | /** |
||
134 | * Clears working model |
||
135 | */ |
||
136 | public function clearWorkingModel() |
||
140 | |||
141 | /** |
||
142 | * Get working model (if none set it will return model) |
||
143 | * |
||
144 | * @return Model |
||
145 | */ |
||
146 | protected function getWorkingModel() |
||
150 | } |
||
151 |
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.