| 1 | <?php |
||
| 11 | class MailTemplate extends Model implements MailTemplateInterface |
||
| 12 | { |
||
| 13 | protected $guarded = []; |
||
| 14 | |||
| 15 | public function scopeForMailable(Builder $query, Mailable $mailable): Builder |
||
| 16 | { |
||
| 17 | return $query->where('mailable', get_class($mailable)); |
||
| 18 | } |
||
| 19 | |||
| 20 | public static function findForMailable(Mailable $mailable): self |
||
| 21 | { |
||
| 22 | $mailTemplate = static::forMailable($mailable)->first(); |
||
|
|
|||
| 23 | |||
| 24 | if (! $mailTemplate) { |
||
| 25 | throw MissingMailTemplate::forMailable($mailable); |
||
| 26 | } |
||
| 27 | |||
| 28 | return $mailTemplate; |
||
| 29 | } |
||
| 30 | |||
| 31 | public function getLayout(): ?string |
||
| 32 | { |
||
| 33 | return null; |
||
| 34 | } |
||
| 35 | |||
| 36 | public function getVariables(): array |
||
| 37 | { |
||
| 38 | $mailableClass = $this->mailable; |
||
| 39 | |||
| 40 | if (! class_exists($mailableClass)) { |
||
| 41 | return []; |
||
| 42 | } |
||
| 43 | |||
| 44 | return $mailableClass::getVariables(); |
||
| 45 | } |
||
| 46 | |||
| 47 | public function getVariablesAttribute(): array |
||
| 51 | |||
| 52 | public function subject(): string |
||
| 53 | { |
||
| 54 | return $this->subject; |
||
| 55 | } |
||
| 56 | |||
| 57 | public function template(): string |
||
| 61 | } |
||
| 62 |
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.