mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 16:57:09 +00: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 Category.
|
||||
*/
|
||||
class Category extends Model
|
||||
{
|
||||
use SoftDeletes, ValidatingTrait;
|
||||
use SoftDeletes;
|
||||
|
||||
/**
|
||||
* The attributes that should be casted to native types.
|
||||
@@ -52,12 +51,11 @@ class Category extends Model
|
||||
protected $fillable = ['user_id', 'name'];
|
||||
/** @var array */
|
||||
protected $hidden = ['encrypted'];
|
||||
/** @var array */
|
||||
protected $rules = ['name' => 'required|between:1,200'];
|
||||
|
||||
/**
|
||||
* @param array $fields
|
||||
*
|
||||
* @deprecated
|
||||
* @return Category
|
||||
*/
|
||||
public static function firstOrCreateEncrypted(array $fields)
|
||||
@@ -91,9 +89,9 @@ class Category extends Model
|
||||
public static function routeBinder(string $value): Category
|
||||
{
|
||||
if (auth()->check()) {
|
||||
$categoryId = intval($value);
|
||||
$categoryId = (int)$value;
|
||||
$category = auth()->user()->categories()->find($categoryId);
|
||||
if (!is_null($category)) {
|
||||
if (null !== $category) {
|
||||
return $category;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user