mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
A set of small fixes, courtesy of scrutinizer-ci
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user