1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace MedianetDev\LaravelAuthApi\Http\Controllers\Traits\Notifications; |
4
|
|
|
|
5
|
|
|
use Illuminate\Notifications\Messages\MailMessage; |
6
|
|
|
use Illuminate\Notifications\Notification; |
7
|
|
|
use Illuminate\Support\Facades\Lang; |
8
|
|
|
|
9
|
|
|
class VerifyEmail extends Notification |
10
|
|
|
{ |
11
|
|
|
/** |
12
|
|
|
* The callback that should be used to build the mail message. |
13
|
|
|
* |
14
|
|
|
* @var \Closure|null |
15
|
|
|
*/ |
16
|
|
|
public static $toMailCallback; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Get the notification's channels. |
20
|
|
|
* |
21
|
|
|
* @param mixed $notifiable |
22
|
|
|
* @return array|string |
23
|
|
|
*/ |
24
|
|
|
public function via($notifiable) |
|
|
|
|
25
|
|
|
{ |
26
|
|
|
return ['mail']; |
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Build the mail representation of the notification. |
31
|
|
|
* |
32
|
|
|
* @param mixed $notifiable |
33
|
|
|
* @return \Illuminate\Notifications\Messages\MailMessage |
34
|
|
|
*/ |
35
|
|
|
public function toMail($notifiable) |
36
|
|
|
{ |
37
|
|
|
if (static::$toMailCallback) { |
38
|
|
|
return call_user_func(static::$toMailCallback, $notifiable); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
return (new MailMessage) |
42
|
|
|
->subject(Lang::get('Verify Email Address ['.hexdec(substr(sha1($notifiable->getKey().$notifiable->getEmailForVerification()), 0, 3)).']')) |
43
|
|
|
->line(Lang::get('MedianetDev\LaravelAuthApi\Notifications\VerifyEmail.php ')) |
44
|
|
|
->action(Lang::get(hexdec(substr(sha1($notifiable->getKey().$notifiable->getEmailForVerification()), 0, 3))), '') |
45
|
|
|
->line(Lang::get('If you did not create an account, no further action is required.')); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Set a callback that should be used when building the notification mail message. |
50
|
|
|
* |
51
|
|
|
* @param \Closure $callback |
52
|
|
|
* @return void |
53
|
|
|
*/ |
54
|
|
|
public static function toMailUsing($callback) |
55
|
|
|
{ |
56
|
|
|
static::$toMailCallback = $callback; |
57
|
|
|
} |
58
|
|
|
} |
59
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.