Total Complexity | 6 |
Total Lines | 53 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
14 | trait Notifiable |
||
15 | { |
||
16 | /** |
||
17 | * Send the given notification. |
||
18 | * |
||
19 | * @param Notification $notification |
||
20 | * |
||
21 | * @return void |
||
22 | */ |
||
23 | public function notify($notification) |
||
24 | { |
||
25 | app(DispatcherInterface::class)->send($this, $notification); |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * Get the notification routing information for the given driver. |
||
30 | * |
||
31 | * @param string $driver |
||
32 | * |
||
33 | * @return mixed |
||
34 | */ |
||
35 | public function routeNotificationFor($driver) |
||
36 | { |
||
37 | // if (method_exists($this, $method = 'routeNotificationFor'.Str::studly($driver))) { |
||
38 | // return $this->{$method}(); |
||
39 | // } |
||
40 | |||
41 | switch ($driver) { |
||
42 | // case 'database': |
||
43 | // return $this->notifications(); |
||
44 | case 'mail': |
||
45 | return $this->getNotificationEmail(); |
||
46 | case 'nexmo': |
||
47 | return $this->getNotificationPhoneNumber(); |
||
48 | } |
||
49 | |||
50 | return null; |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * @return string |
||
55 | */ |
||
56 | public function getNotificationEmail() |
||
57 | { |
||
58 | return $this->email; |
||
59 | } |
||
60 | |||
61 | /** |
||
62 | * @return string |
||
63 | */ |
||
64 | public function getNotificationPhoneNumber() |
||
67 | } |
||
68 | } |
||
69 |