Skip to content

Commit

Permalink
Merge pull request #2 from yoelfme/scrutinizer-patch-1
Browse files Browse the repository at this point in the history
Scrutinizer Auto-Fixes
  • Loading branch information
Yoel Monzón committed Dec 29, 2015
2 parents 6d92297 + 5a2a668 commit a399767
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ abstract class Repository implements RepositoryInterface
function __construct(Application $app) {
$this->app = $app;
$this->makeModel();
$this->relations = ($this->model->_relations ? $this->model->_relations : [] );
$this->relations = ($this->model->_relations ? $this->model->_relations : []);
}

/**
Expand All @@ -51,7 +51,7 @@ public function makeModel()
$name_model = $this->model();
$model = $this->app->make($name_model);

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

Expand Down Expand Up @@ -134,7 +134,7 @@ public function takeRandomByWithRelations($limit, $field, $value)
/**
* Return all rows with relations
* @param array $columns
* @return mixed
* @return \Illuminate\Database\Eloquent\Collection
*/
public function allWithRelations($columns = array('*'))
{
Expand Down Expand Up @@ -167,7 +167,7 @@ public function paginateByFiltersWithAllRelations($filters = array(), $perPage =
{
$query = $this->model->with($this->relations);

foreach($filters as $field => $value) {
foreach ($filters as $field => $value) {
$query->where($field, $value);
}

Expand All @@ -178,7 +178,7 @@ public function paginateByFiltersWithAllRelations($filters = array(), $perPage =
/**
* Create a record of model
* @param array $data
* @return mixed
* @return Model
*/
public function create(array $data)
{
Expand All @@ -193,7 +193,7 @@ public function create(array $data)
*/
public function update(array $data, $entity)
{
if(is_numeric($entity))
if (is_numeric($entity))
{
$entity = $this->findOrFail($entity);
}
Expand All @@ -207,13 +207,13 @@ public function update(array $data, $entity)
/**
* Delete a record by id of record or entity
* @param $entity
* @return null
* @return boolean
*/
public function delete($entity)
{
try
{
if(is_numeric($entity))
if (is_numeric($entity))
{
$this->model->destroy($entity);
}
Expand All @@ -223,7 +223,7 @@ public function delete($entity)
}
return true;
}
catch(\Exception $e)
catch (\Exception $e)
{
return false;
}
Expand All @@ -244,7 +244,7 @@ public function where($field, $value, $columns = array('*'))
* @param string $field
* @param string $value
* @param array $columns
* @return mixed
* @return \Illuminate\Database\Eloquent\Collection
*/
public function whereWithRelations($field, $value, $columns = array('*'))
{
Expand Down

0 comments on commit a399767

Please sign in to comment.