morphTo(); } /** * @codeCoverageIgnore * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function user() { return $this->belongsTo('FireflyIII\User'); } /** * @codeCoverageIgnore * * @param $value * * @return null|string */ public function getFilenameAttribute($value) { if (is_null($value)) { return null; } return Crypt::decrypt($value); } /** * @param string $value */ public function setFilenameAttribute($value) { $this->attributes['filename'] = Crypt::encrypt($value); } /** * @codeCoverageIgnore * * @param $value * * @return null|string */ public function getMimeAttribute($value) { if (is_null($value)) { return null; } return Crypt::decrypt($value); } /** * @param string $value */ public function setMimeAttribute($value) { $this->attributes['mime'] = Crypt::encrypt($value); } /** * @codeCoverageIgnore * * @param $value * * @return null|string */ public function getTitleAttribute($value) { if (is_null($value)) { return null; } return Crypt::decrypt($value); } /** * @param string $value */ public function setTitleAttribute($value) { $this->attributes['title'] = Crypt::encrypt($value); } /** * @codeCoverageIgnore * * @param $value * * @return null|string */ public function getDescriptionAttribute($value) { if (is_null($value)) { return null; } return Crypt::decrypt($value); } /** * @param string $value */ public function setDescriptionAttribute($value) { $this->attributes['description'] = Crypt::encrypt($value); } /** * @codeCoverageIgnore * * @param $value * * @return null|string */ public function getNotesAttribute($value) { if (is_null($value)) { return null; } return Crypt::decrypt($value); } /** * @param string $value */ public function setNotesAttribute($value) { $this->attributes['notes'] = Crypt::encrypt($value); } /** * @param Attachment $value * * @return Attachment */ public static function routeBinder(Attachment $value) { if (Auth::check()) { if ($value->user_id == Auth::user()->id) { return $value; } } throw new NotFoundHttpException; } }