mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-22 20:16:22 +00:00
A set of small fixes, courtesy of scrutinizer-ci
This commit is contained in:
@@ -25,15 +25,16 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @property-read User $user
|
||||
* @property string $dateFormatted
|
||||
* @property string $budgeted
|
||||
* @property float $amount
|
||||
*/
|
||||
class Budget extends Model
|
||||
{
|
||||
|
||||
use SoftDeletes;
|
||||
|
||||
protected $dates = ['created_at', 'updated_at', 'deleted_at', 'startdate', 'enddate'];
|
||||
protected $fillable = ['user_id', 'name', 'active'];
|
||||
protected $hidden = ['encrypted'];
|
||||
protected $dates = ['created_at', 'updated_at', 'deleted_at', 'startdate', 'enddate'];
|
||||
|
||||
/**
|
||||
* @param array $fields
|
||||
@@ -63,6 +64,21 @@ class Budget extends Model
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Budget $value
|
||||
*
|
||||
* @return Budget
|
||||
*/
|
||||
public static function routeBinder(Budget $value)
|
||||
{
|
||||
if (Auth::check()) {
|
||||
if ($value->user_id == Auth::user()->id) {
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
throw new NotFoundHttpException;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
@@ -120,20 +136,5 @@ class Budget extends Model
|
||||
return $this->belongsTo('FireflyIII\User');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Budget $value
|
||||
*
|
||||
* @return Budget
|
||||
*/
|
||||
public static function routeBinder(Budget $value)
|
||||
{
|
||||
if (Auth::check()) {
|
||||
if ($value->user_id == Auth::user()->id) {
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
throw new NotFoundHttpException;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user