Code cleanup

This commit is contained in:
James Cole
2018-04-02 15:10:40 +02:00
parent fa7ab45a40
commit a3c34e6b3c
151 changed files with 802 additions and 990 deletions

View File

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