Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
namespace Illuminate\Notifications;
4
 
5
use Illuminate\Contracts\Notifications\Dispatcher;
6
use Illuminate\Support\Str;
7
 
8
trait RoutesNotifications
9
{
10
    /**
11
     * Send the given notification.
12
     *
13
     * @param  mixed  $instance
14
     * @return void
15
     */
16
    public function notify($instance)
17
    {
18
        app(Dispatcher::class)->send($this, $instance);
19
    }
20
 
21
    /**
22
     * Send the given notification immediately.
23
     *
24
     * @param  mixed  $instance
25
     * @param  array|null  $channels
26
     * @return void
27
     */
28
    public function notifyNow($instance, array $channels = null)
29
    {
30
        app(Dispatcher::class)->sendNow($this, $instance, $channels);
31
    }
32
 
33
    /**
34
     * Get the notification routing information for the given driver.
35
     *
36
     * @param  string  $driver
37
     * @param  \Illuminate\Notifications\Notification|null  $notification
38
     * @return mixed
39
     */
40
    public function routeNotificationFor($driver, $notification = null)
41
    {
42
        if (method_exists($this, $method = 'routeNotificationFor'.Str::studly($driver))) {
43
            return $this->{$method}($notification);
44
        }
45
 
46
        return match ($driver) {
47
            'database' => $this->notifications(),
48
            'mail' => $this->email,
49
            default => null,
50
        };
51
    }
52
}