A set of small fixes, courtesy of scrutinizer-ci

This commit is contained in:
James Cole
2016-01-27 18:31:44 +01:00
parent e8776d44c5
commit 9155c13e08
16 changed files with 261 additions and 256 deletions

View File

@@ -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;
}
}