diff --git a/changelog.md b/changelog.md index 2a27402..60d02c8 100644 --- a/changelog.md +++ b/changelog.md @@ -271,3 +271,13 @@ New Structure: ### Changed Laravel 9 Support + +## Version 4.0.1 + +## Added +- Improve error messages for event when a factory is not found when the setting is on to use them + +## Version 4.0.2 + +## Added +- Allow the subject to be displayed in the mailables table instead of Namespace values diff --git a/config/maileclipse.php b/config/maileclipse.php index 74d8cc9..dcf217e 100644 --- a/config/maileclipse.php +++ b/config/maileclipse.php @@ -32,6 +32,18 @@ 'factory' => true, + /* + |-------------------------------------------------------------------------- + | Display Mailable Subject + |-------------------------------------------------------------------------- + | + | Set to true this will display the subject of the Mailable instead of Class Name. + | When the config setting is false the namespace/class name is shown + | options: true / false + | + */ + 'display_as_subject' => true, + /* |-------------------------------------------------------------------------- | Relationship loading. diff --git a/resources/views/sections/mailables.blade.php b/resources/views/sections/mailables.blade.php index cb527e2..f68b1ce 100644 --- a/resources/views/sections/mailables.blade.php +++ b/resources/views/sections/mailables.blade.php @@ -31,7 +31,7 @@ {{ __('Name') }} - {{ __('Namespace') }} + {{ config('maileclipse.display_as_subject') ? __('Subject') : __('Namespace')}} {{ __('Last edited') }} @@ -42,7 +42,7 @@ {{ $mailable['name'] }} - {{ $mailable['namespace'] }} + {{ config('maileclipse.display_as_subject') ? $mailable['subject'] ? $mailable['namespace'] }} {{ (\Carbon\Carbon::createFromTimeStamp($mailable['modified']))->diffForHumans() }} diff --git a/resources/views/sections/view-mailable.blade.php b/resources/views/sections/view-mailable.blade.php index 8438cb2..74c3c14 100644 --- a/resources/views/sections/view-mailable.blade.php +++ b/resources/views/sections/view-mailable.blade.php @@ -32,14 +32,20 @@ - @if ( !empty($resource['data']->subject) ) - - Subject - - {{ $resource['data']->subject }} - - - @endif + + Subject + @if ( empty($resource['data']->subject) ) + + No Subject Set, The default Namespace will be used. See Custom the subject + + @else + + {{ $resource['data']->subject }} + + + @endif + + @if ( !empty($resource['data']->locale) ) diff --git a/src/MailEclipse.php b/src/MailEclipse.php index 9c0ccd1..92f26d2 100644 --- a/src/MailEclipse.php +++ b/src/MailEclipse.php @@ -29,7 +29,7 @@ class MailEclipse { public const VIEW_NAMESPACE = 'maileclipse'; - public const VERSION = '4.0.1'; + public const VERSION = '4.0.2'; /** * Default type examples for being passed to reflected classes. @@ -525,6 +525,9 @@ protected static function mailablesList() $fqcns[$i]['view_path'] = null; $fqcns[$i]['text_view_path'] = null; + /** @see \Illuminate\Mail\Mailable@buildSubject for the Str Functions, used to keep consistent. */ + $fqcns[$i]['subject'] = $mailable_data->subject ?? Str::title(Str::snake(class_basename($mailableClass), ' ')); + if (! is_null($fqcns[$i]['markdown']) && View::exists($fqcns[$i]['markdown'])) { $fqcns[$i]['view_path'] = View($fqcns[$i]['markdown'])->getPath(); }