Refactor models.

This commit is contained in:
James Cole
2025-09-14 09:00:01 +02:00
parent 935453796e
commit 9d9483e20f
46 changed files with 688 additions and 676 deletions

View File

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