File tree Expand file tree Collapse file tree 3 files changed +12
-13
lines changed Expand file tree Collapse file tree 3 files changed +12
-13
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ $ composer require mehedimi/laravel-amp-mail
7
7
```
8
8
9
9
## Quick Usages
10
- To send amp email just use ` Mehedi\Mimes\Amp ` trait on your mail class and load amp view by using ` amp ` method.
10
+ To send amp email just use ` Mehedi\AmpMail\ Mimes\Amp ` trait on your mail class and load amp view by using ` amp ` method.
11
11
### Example
12
12
``` php
13
13
<?php
@@ -17,7 +17,7 @@ namespace App\Mail;
17
17
use Illuminate\Bus\Queueable;
18
18
use Illuminate\Mail\Mailable;
19
19
use Illuminate\Queue\SerializesModels;
20
- use Mehedi\Mimes\Amp;
20
+ use Mehedi\AmpMail\ Mimes\Amp;
21
21
22
22
class WelcomeEmail extends Mailable
23
23
{
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " mehedimi/laravel-amp-mail" ,
3
- "version" : " 1 .0.0" ,
3
+ "version" : " 2 .0.0" ,
4
4
"description" : " Send amp mail through laravel mail" ,
5
5
"license" : [" MIT" ],
6
6
"authors" : [
14
14
},
15
15
"autoload" : {
16
16
"psr-4" : {
17
- "Mehedi\\ " : " src/"
17
+ "Mehedi\\ AmpMail \\ " : " src/"
18
18
}
19
19
}
20
20
}
Original file line number Diff line number Diff line change 1
1
<?php
2
2
3
- namespace Mehedi \Mimes ;
3
+ namespace Mehedi \AmpMail \ Mimes ;
4
4
5
5
use Illuminate \Support \Facades \View ;
6
6
@@ -25,21 +25,20 @@ public function amp($view, array $data = [])
25
25
$ this ->ampView = $ view ;
26
26
$ this ->viewData = array_merge ($ this ->viewData , $ data );
27
27
28
- return $ this ;
28
+ return $ this -> addAmpPart () ;
29
29
}
30
30
31
31
/**
32
- * Run the callbacks for the message.
32
+ * Register a callback for add amp part on message
33
33
*
34
- * @param \Illuminate\Mail\Message $message
35
34
* @return $this
36
35
*/
37
- protected function runCallbacks ( $ message )
36
+ protected function addAmpPart ( )
38
37
{
39
- parent :: runCallbacks ( $ message );
40
-
41
- $ message ->getSwiftMessage ()
42
- -> addPart ( $ this -> renderAmpView (), ' text/x-amp-html ' , ' utf-8 ' );
38
+ $ this -> withSwiftMessage ( function ( $ message ) {
39
+ /** @var $message \Swift_Message */
40
+ $ message ->addPart ( $ this -> renderAmpView (), ' text/x-amp-html ' , ' utf-8 ' );
41
+ } );
43
42
44
43
return $ this ;
45
44
}
You can’t perform that action at this time.
0 commit comments