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

@@ -26,14 +26,13 @@ use Crypt;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Watson\Validating\ValidatingTrait;
/**
* Class Tag.
*/
class Tag extends Model
{
use ValidatingTrait, SoftDeletes;
use SoftDeletes;
/**
* The attributes that should be casted to native types.
@@ -52,12 +51,11 @@ class Tag extends Model
protected $dates = ['date'];
/** @var array */
protected $fillable = ['user_id', 'tag', 'date', 'description', 'longitude', 'latitude', 'zoomLevel', 'tagMode'];
/** @var array */
protected $rules = ['tag' => 'required|between:1,200'];
/**
* @param array $fields
*
* @deprecated
* @return Tag|null
*/
public static function firstOrCreateEncrypted(array $fields)
@@ -95,9 +93,9 @@ class Tag extends Model
public static function routeBinder(string $value): Tag
{
if (auth()->check()) {
$tagId = intval($value);
$tagId = (int)$value;
$tag = auth()->user()->tags()->find($tagId);
if (!is_null($tag)) {
if (null !== $tag) {
return $tag;
}
}
@@ -154,6 +152,7 @@ class Tag extends Model
* @codeCoverageIgnore
*
* @param $value
*
* @throws \Illuminate\Contracts\Encryption\EncryptException
*/
public function setTagAttribute($value)