@@ -32,7 +32,7 @@ abstract class Repository implements RepositoryInterface
32
32
function __construct (Application $ app ) {
33
33
$ this ->app = $ app ;
34
34
$ this ->makeModel ();
35
- $ this ->relations = ($ this ->model ->_relations ? $ this ->model ->_relations : [] );
35
+ $ this ->relations = ($ this ->model ->_relations ? $ this ->model ->_relations : []);
36
36
}
37
37
38
38
/**
@@ -51,7 +51,7 @@ public function makeModel()
51
51
$ name_model = $ this ->model ();
52
52
$ model = $ this ->app ->make ($ name_model );
53
53
54
- if (!$ model instanceof Model) {
54
+ if (!$ model instanceof Model) {
55
55
throw new \Exception ("Class { $ name_model } must be an instance of Illuminate \\Database \\Eloquent \\Model " );
56
56
}
57
57
@@ -134,7 +134,7 @@ public function takeRandomByWithRelations($limit, $field, $value)
134
134
/**
135
135
* Return all rows with relations
136
136
* @param array $columns
137
- * @return mixed
137
+ * @return \Illuminate\Database\Eloquent\Collection
138
138
*/
139
139
public function allWithRelations ($ columns = array ('* ' ))
140
140
{
@@ -167,7 +167,7 @@ public function paginateByFiltersWithAllRelations($filters = array(), $perPage =
167
167
{
168
168
$ query = $ this ->model ->with ($ this ->relations );
169
169
170
- foreach ($ filters as $ field => $ value ) {
170
+ foreach ($ filters as $ field => $ value ) {
171
171
$ query ->where ($ field , $ value );
172
172
}
173
173
@@ -178,7 +178,7 @@ public function paginateByFiltersWithAllRelations($filters = array(), $perPage =
178
178
/**
179
179
* Create a record of model
180
180
* @param array $data
181
- * @return mixed
181
+ * @return Model
182
182
*/
183
183
public function create (array $ data )
184
184
{
@@ -193,7 +193,7 @@ public function create(array $data)
193
193
*/
194
194
public function update (array $ data , $ entity )
195
195
{
196
- if (is_numeric ($ entity ))
196
+ if (is_numeric ($ entity ))
197
197
{
198
198
$ entity = $ this ->findOrFail ($ entity );
199
199
}
@@ -207,13 +207,13 @@ public function update(array $data, $entity)
207
207
/**
208
208
* Delete a record by id of record or entity
209
209
* @param $entity
210
- * @return null
210
+ * @return boolean
211
211
*/
212
212
public function delete ($ entity )
213
213
{
214
214
try
215
215
{
216
- if (is_numeric ($ entity ))
216
+ if (is_numeric ($ entity ))
217
217
{
218
218
$ this ->model ->destroy ($ entity );
219
219
}
@@ -223,7 +223,7 @@ public function delete($entity)
223
223
}
224
224
return true ;
225
225
}
226
- catch (\Exception $ e )
226
+ catch (\Exception $ e )
227
227
{
228
228
return false ;
229
229
}
@@ -244,7 +244,7 @@ public function where($field, $value, $columns = array('*'))
244
244
* @param string $field
245
245
* @param string $value
246
246
* @param array $columns
247
- * @return mixed
247
+ * @return \Illuminate\Database\Eloquent\Collection
248
248
*/
249
249
public function whereWithRelations ($ field , $ value , $ columns = array ('* ' ))
250
250
{
0 commit comments