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

Commit

Permalink
Merge pull request #198 from Qoraiche/merge-v3-updates
Browse files Browse the repository at this point in the history
Merge v3 updates
  • Loading branch information
ReeceM authored Feb 11, 2022
2 parents 76992f8 + de46b9f commit 5adce0e
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 11 deletions.
10 changes: 10 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 12 additions & 0 deletions config/maileclipse.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions resources/views/sections/mailables.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<thead>
<tr>
<th scope="col">{{ __('Name') }}</th>
<th scope="col">{{ __('Namespace') }}</th>
<th scope="col">{{ config('maileclipse.display_as_subject') ? __('Subject') : __('Namespace')}}</th>
<th scope="col">{{ __('Last edited') }}</th>
<th scope="col"></th>
</tr>
Expand All @@ -42,7 +42,7 @@
<td class="pr-0">
{{ $mailable['name'] }}
</td>
<td class="text-muted" title="/tee">{{ $mailable['namespace'] }} </td>
<td class="text-muted" title="{{ $mailable['namespace'] }}">{{ config('maileclipse.display_as_subject') ? $mailable['subject'] ? $mailable['namespace'] }}</td>

<td class="table-fit"><span>{{ (\Carbon\Carbon::createFromTimeStamp($mailable['modified']))->diffForHumans() }}</span></td>

Expand Down
22 changes: 14 additions & 8 deletions resources/views/sections/view-mailable.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,20 @@
</td>
</tr>

@if ( !empty($resource['data']->subject) )
<tr>
<td class="table-fit font-weight-sixhundred">Subject</td>
<td>
{{ $resource['data']->subject }}
</td>
</tr>
@endif
<tr>
<td class="table-fit font-weight-sixhundred">Subject</td>
@if ( empty($resource['data']->subject) )
<td>
<span class="text-muted">No Subject Set, The default Namespace will be used. See <a href="https://laravel.com/docs/9.x/notifications#customizing-the-subject">Custom the subject</a></span>
</td>
@else
<td>
{{ $resource['data']->subject }}
</td>

@endif
</tr>


@if ( !empty($resource['data']->locale) )
<tr>
Expand Down
5 changes: 4 additions & 1 deletion src/MailEclipse.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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();
}
Expand Down

0 comments on commit 5adce0e

Please sign in to comment.