Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Commit

Permalink
fix: compatible way to call the method on mailable
Browse files Browse the repository at this point in the history
  • Loading branch information
ReeceM committed Nov 3, 2022
1 parent 8a38e3c commit 7333c8a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/MailEclipse.php
Original file line number Diff line number Diff line change
Expand Up @@ -802,12 +802,14 @@ protected static function getMarkdownViewName($mailable)
*/
public static function buildMailable($instance, $type = 'call')
{
$method = method_exists($instance, 'build') ? 'build' : 'render';

if ($type === 'call') {
if (self::handleMailableViewDataArgs($instance) !== null) {
return app()->call([self::handleMailableViewDataArgs($instance), 'build']);
return app()->call([self::handleMailableViewDataArgs($instance), $method]);
}

return app()->call([new $instance, 'build']);
return app()->call([new $instance, $method]);
}

return app()->make($instance);
Expand Down

0 comments on commit 7333c8a

Please sign in to comment.