1 | <?php namespace Usman\Guardian\Repositories; |
||
6 | abstract class BaseRepository implements BaseRepositoryInterface { |
||
7 | |||
8 | const PAGE = 20; |
||
9 | |||
10 | /** |
||
11 | * The Model Instance |
||
12 | * |
||
13 | * @var Model |
||
14 | */ |
||
15 | protected $model; |
||
16 | |||
17 | /** |
||
18 | * Creates a new repository |
||
19 | * |
||
20 | * @param Illuminate\Database\Eloquent\Model $model |
||
21 | */ |
||
22 | public function __construct(Model $model) |
||
26 | |||
27 | /** |
||
28 | * Finds a single record by given id. |
||
29 | * |
||
30 | * @param int $id |
||
31 | * @return Illuminate\Database\Eloquent\Model |
||
32 | */ |
||
33 | public function findById($id) |
||
37 | |||
38 | /** |
||
39 | * Retrieves a single record from storage with related records |
||
40 | * |
||
41 | * @param int $id |
||
42 | * @param string $related |
||
43 | * @return Illuminate\Database\Eloquent\Model |
||
44 | */ |
||
45 | public function findByIdWith($id, $related) |
||
49 | |||
50 | /** |
||
51 | * Retrieves a single page of records with related records |
||
52 | * |
||
53 | * @param string $related |
||
54 | * @param int $perPage |
||
55 | * @return Illuminate\Pagination\Paginator an instance of paginator. |
||
56 | */ |
||
57 | public function getbyPageWith($related, $perPage = self::PAGE) |
||
61 | |||
62 | /** |
||
63 | * Retrieves all records from storage |
||
64 | * |
||
65 | * @param array $col |
||
66 | * @return Illuminate\Support\Collection |
||
67 | */ |
||
68 | public function getAll($col = ['*']) |
||
72 | |||
73 | /** |
||
74 | * Template method for creating a record in storage |
||
75 | * |
||
76 | * @param array $fields |
||
77 | * @return mixed |
||
78 | */ |
||
79 | public function create(array $fields) |
||
84 | |||
85 | /** |
||
86 | * Template method for updating a record in storage |
||
87 | * |
||
88 | * @param int $id |
||
89 | * @param array $fields |
||
90 | * @return bool |
||
91 | */ |
||
92 | public function update($id, array $fields) |
||
99 | |||
100 | /** |
||
101 | * Deletes a record from storage |
||
102 | * |
||
103 | * @param int $id |
||
104 | * @return bool |
||
105 | */ |
||
106 | public function delete($id) |
||
110 | |||
111 | /** |
||
112 | * Deletes a record and its related records. |
||
113 | * |
||
114 | * @param int $id |
||
115 | * @param array $method methods that define the relation |
||
116 | * @return bool |
||
117 | */ |
||
118 | public function deleteWith($id, array $methods) |
||
129 | |||
130 | /** |
||
131 | * Attaches the related ids in pivot table |
||
132 | * |
||
133 | * @param ind $id |
||
134 | * @param array $ids |
||
135 | * @param string $method Name of the method that defines the relation |
||
136 | * @return void |
||
137 | */ |
||
138 | public function attach($id, array $ids = [], $method) |
||
150 | |||
151 | /** |
||
152 | * Fills the model attributes. |
||
153 | * |
||
154 | * @param array $data |
||
155 | * @return void |
||
156 | */ |
||
157 | abstract protected function fillData(array $data); |
||
158 | |||
159 | } |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..