What happened?
In the MailDownloadController
We are providing our own MailAttachment model using config and package should reslve the model from the config instead of harcoding.
We are customizing the storage path and using the hardcoded model is always resolve storage path from the package model (not our own model).
How to reproduce the bug
- Create a MailAttachment model
<?php
namespace App\Models;
class MailAttachment extends \Vormkracht10\Mails\Models\MailAttachment
{
public function getStoragePathAttribute(): string
{
$tenantId = $this->mail->tenant_id ?? null;
if ($tenantId) {
return rtrim(config('mails.logging.attachments.root'), '/') . '/' . $tenantId . '/' . $this->getKey() . '/' . $this->filename;
}
return rtrim(config('mails.logging.attachments.root'), '/') . '/' . $this->getKey() . '/' . $this->filename;
}
}
- Try downloading file
It will give file not found error since files are stored with tenant path and MailDownloadController get the path without a tenant in it because because is using \Vormkracht10\Mails\Models\MailAttachment instead of config('mails.models.attachment')
Package Version
2.3
PHP Version
8.3
Laravel Version
11
Which operating systems does with happen with?
macOS
Notes
No response
What happened?
In the MailDownloadController
We are providing our own MailAttachment model using config and package should reslve the model from the config instead of harcoding.
We are customizing the storage path and using the hardcoded model is always resolve storage path from the package model (not our own model).
How to reproduce the bug
It will give file not found error since files are stored with tenant path and MailDownloadController get the path without a tenant in it because because is using
\Vormkracht10\Mails\Models\MailAttachmentinstead ofconfig('mails.models.attachment')Package Version
2.3
PHP Version
8.3
Laravel Version
11
Which operating systems does with happen with?
macOS
Notes
No response