Apply fixes from StyleCI

This commit is contained in:
Nabeel Shahzad
2018-08-26 16:40:04 +00:00
committed by StyleCI Bot
parent 20f46adbc4
commit 9596d88b48
407 changed files with 4032 additions and 3286 deletions

View File

@@ -6,13 +6,13 @@ use Illuminate\Validation\Validator;
/**
* Class Repository
* @package App\Interfaces
*/
abstract class Repository extends \Prettus\Repository\Eloquent\BaseRepository
{
/**
* @param $id
* @param array $columns
*
* @return mixed|null
*/
public function findWithoutFail($id, $columns = ['*'])
@@ -20,12 +20,13 @@ abstract class Repository extends \Prettus\Repository\Eloquent\BaseRepository
try {
return $this->find($id, $columns);
} catch (\Exception $e) {
return null;
return;
}
}
/**
* @param $values
*
* @return bool
*/
public function validate($values)
@@ -44,8 +45,10 @@ abstract class Repository extends \Prettus\Repository\Eloquent\BaseRepository
/**
* Return N most recent items, sorted by created_at
*
* @param int $count
* @param string $sort_by created_at (default) or updated_at
*
* @return mixed
*/
public function recent($count = null, $sort_by = 'created_at')
@@ -55,16 +58,18 @@ abstract class Repository extends \Prettus\Repository\Eloquent\BaseRepository
/**
* Find records with a WHERE clause but also sort them
*
* @param $where
* @param $sort_by
* @param $order_by
*
* @return $this
*/
public function whereOrder($where, $sort_by, $order_by = 'asc')
{
return $this->scopeQuery(function ($query) use ($where, $sort_by, $order_by) {
$q = $query->where($where);
# See if there are multi-column sorts
// See if there are multi-column sorts
if (\is_array($sort_by)) {
foreach ($sort_by as $key => $sort) {
$q = $q->orderBy($key, $sort);
@@ -79,17 +84,19 @@ abstract class Repository extends \Prettus\Repository\Eloquent\BaseRepository
/**
* Find records where values don't match a list but sort the rest
*
* @param string $col
* @param array $values
* @param string $sort_by
* @param string $order_by
*
* @return $this
*/
public function whereNotInOrder($col, $values, $sort_by, $order_by = 'asc')
{
return $this->scopeQuery(function ($query) use ($col, $values, $sort_by, $order_by) {
$q = $query->whereNotIn($col, $values);
# See if there are multi-column sorts
// See if there are multi-column sorts
if (\is_array($sort_by)) {
foreach ($sort_by as $key => $sort) {
$q = $q->orderBy($key, $sort);