dcblogdev / laravel-sent-emails

Store outgoing emails in Laravel
MIT License
249 stars 24 forks source link

Lazy loading since 2.0.5 #23

Closed matejvelikonja closed 1 month ago

matejvelikonja commented 4 months ago

Since the latest version, the page throws lazy loading issue.

dcblogdev commented 3 months ago

Can you provide more details on this issue?

matejvelikonja commented 2 months ago

I have configured Laravel to throw an error when lazy loading is detected. As a result, I'm encountering the following error with the newest version:

Attempted to lazy load [attachments] on model [Dcblogdev\LaravelSentEmails\Models\SentEmail] but lazy loading is disabled. (View: /xxx/vendor/dcblogdev/laravel-sent-emails/src/resources/views/index.blade.php)

I believe that a with statement should be added to this line in the SentEmailsController to load attachments together with emails. This will prevent n+1 query issues.

dcblogdev commented 1 month ago

thanks I've pushed a release that adds this in.