Code cleanup

This commit is contained in:
James Cole
2018-04-02 15:10:40 +02:00
parent fa7ab45a40
commit a3c34e6b3c
151 changed files with 802 additions and 990 deletions

View File

@@ -27,14 +27,13 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Watson\Validating\ValidatingTrait;
/**
* Class Budget.
*/
class Budget extends Model
{
use SoftDeletes, ValidatingTrait;
use SoftDeletes;
/**
* The attributes that should be casted to native types.
@@ -53,12 +52,11 @@ class Budget extends Model
protected $fillable = ['user_id', 'name', 'active'];
/** @var array */
protected $hidden = ['encrypted'];
/** @var array */
protected $rules = ['name' => 'required|between:1,200'];
/**
* @param array $fields
*
* @deprecated
* @return Budget
*/
public static function firstOrCreateEncrypted(array $fields)
@@ -92,9 +90,9 @@ class Budget extends Model
public static function routeBinder(string $value): Budget
{
if (auth()->check()) {
$budgetId = intval($value);
$budgetId = (int)$value;
$budget = auth()->user()->budgets()->find($budgetId);
if (!is_null($budget)) {
if (null !== $budget) {
return $budget;
}
}