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

@@ -22,14 +22,15 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property-read Collection|TransactionJournal[] $transactionjournals
* @property-read User $user
* @property string $dateFormatted
* @property float $spent
*/
class Category extends Model
{
use SoftDeletes;
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
protected $fillable = ['user_id', 'name'];
protected $hidden = ['encrypted'];
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
/**
* @param array $fields
@@ -59,6 +60,21 @@ class Category extends Model
}
/**
* @param Category $value
*
* @return Category
*/
public static function routeBinder(Category $value)
{
if (Auth::check()) {
if ($value->user_id == Auth::user()->id) {
return $value;
}
}
throw new NotFoundHttpException;
}
/**
* @codeCoverageIgnore
*
@@ -105,19 +121,4 @@ class Category extends Model
return $this->belongsTo('FireflyIII\User');
}
/**
* @param Category $value
*
* @return Category
*/
public static function routeBinder(Category $value)
{
if (Auth::check()) {
if ($value->user_id == Auth::user()->id) {
return $value;
}
}
throw new NotFoundHttpException;
}
}