mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 00:27:30 +00:00
Refactor models.
This commit is contained in:
@@ -53,13 +53,13 @@ class Attachment extends Model
|
||||
public static function routeBinder(string $value): self
|
||||
{
|
||||
if (auth()->check()) {
|
||||
$attachmentId = (int) $value;
|
||||
$attachmentId = (int)$value;
|
||||
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
$user = auth()->user();
|
||||
|
||||
/** @var null|Attachment $attachment */
|
||||
$attachment = $user->attachments()->find($attachmentId);
|
||||
$attachment = $user->attachments()->find($attachmentId);
|
||||
if (null !== $attachment) {
|
||||
return $attachment;
|
||||
}
|
||||
@@ -86,7 +86,7 @@ class Attachment extends Model
|
||||
*/
|
||||
public function fileName(): string
|
||||
{
|
||||
return sprintf('at-%s.data', (string) $this->id);
|
||||
return sprintf('at-%s.data', (string)$this->id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,7 +100,7 @@ class Attachment extends Model
|
||||
protected function attachableId(): Attribute
|
||||
{
|
||||
return Attribute::make(
|
||||
get: static fn ($value) => (int) $value,
|
||||
get: static fn($value) => (int)$value,
|
||||
);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user