Skip to content

Commit a399767

Browse files
author
Yoel Monzón
committed
Merge pull request #2 from yoelfme/scrutinizer-patch-1
Scrutinizer Auto-Fixes
2 parents 6d92297 + 5a2a668 commit a399767

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/Repository.php

+10-10
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ abstract class Repository implements RepositoryInterface
3232
function __construct(Application $app) {
3333
$this->app = $app;
3434
$this->makeModel();
35-
$this->relations = ($this->model->_relations ? $this->model->_relations : [] );
35+
$this->relations = ($this->model->_relations ? $this->model->_relations : []);
3636
}
3737

3838
/**
@@ -51,7 +51,7 @@ public function makeModel()
5151
$name_model = $this->model();
5252
$model = $this->app->make($name_model);
5353

54-
if(!$model instanceof Model) {
54+
if (!$model instanceof Model) {
5555
throw new \Exception("Class { $name_model } must be an instance of Illuminate\\Database\\Eloquent\\Model");
5656
}
5757

@@ -134,7 +134,7 @@ public function takeRandomByWithRelations($limit, $field, $value)
134134
/**
135135
* Return all rows with relations
136136
* @param array $columns
137-
* @return mixed
137+
* @return \Illuminate\Database\Eloquent\Collection
138138
*/
139139
public function allWithRelations($columns = array('*'))
140140
{
@@ -167,7 +167,7 @@ public function paginateByFiltersWithAllRelations($filters = array(), $perPage =
167167
{
168168
$query = $this->model->with($this->relations);
169169

170-
foreach($filters as $field => $value) {
170+
foreach ($filters as $field => $value) {
171171
$query->where($field, $value);
172172
}
173173

@@ -178,7 +178,7 @@ public function paginateByFiltersWithAllRelations($filters = array(), $perPage =
178178
/**
179179
* Create a record of model
180180
* @param array $data
181-
* @return mixed
181+
* @return Model
182182
*/
183183
public function create(array $data)
184184
{
@@ -193,7 +193,7 @@ public function create(array $data)
193193
*/
194194
public function update(array $data, $entity)
195195
{
196-
if(is_numeric($entity))
196+
if (is_numeric($entity))
197197
{
198198
$entity = $this->findOrFail($entity);
199199
}
@@ -207,13 +207,13 @@ public function update(array $data, $entity)
207207
/**
208208
* Delete a record by id of record or entity
209209
* @param $entity
210-
* @return null
210+
* @return boolean
211211
*/
212212
public function delete($entity)
213213
{
214214
try
215215
{
216-
if(is_numeric($entity))
216+
if (is_numeric($entity))
217217
{
218218
$this->model->destroy($entity);
219219
}
@@ -223,7 +223,7 @@ public function delete($entity)
223223
}
224224
return true;
225225
}
226-
catch(\Exception $e)
226+
catch (\Exception $e)
227227
{
228228
return false;
229229
}
@@ -244,7 +244,7 @@ public function where($field, $value, $columns = array('*'))
244244
* @param string $field
245245
* @param string $value
246246
* @param array $columns
247-
* @return mixed
247+
* @return \Illuminate\Database\Eloquent\Collection
248248
*/
249249
public function whereWithRelations($field, $value, $columns = array('*'))
250250
{

0 commit comments

Comments
 (0)