mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Code cleanup
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user