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\Foundation\Events;
4
 
5
trait Dispatchable
6
{
7
    /**
8
     * Dispatch the event with the given arguments.
9
     *
10
     * @return void
11
     */
12
    public static function dispatch()
13
    {
14
        return event(new static(...func_get_args()));
15
    }
16
 
17
    /**
18
     * Dispatch the event with the given arguments if the given truth test passes.
19
     *
20
     * @param  bool  $boolean
21
     * @param  mixed  ...$arguments
22
     * @return void
23
     */
24
    public static function dispatchIf($boolean, ...$arguments)
25
    {
26
        if ($boolean) {
27
            return event(new static(...$arguments));
28
        }
29
    }
30
 
31
    /**
32
     * Dispatch the event with the given arguments unless the given truth test passes.
33
     *
34
     * @param  bool  $boolean
35
     * @param  mixed  ...$arguments
36
     * @return void
37
     */
38
    public static function dispatchUnless($boolean, ...$arguments)
39
    {
40
        if (! $boolean) {
41
            return event(new static(...$arguments));
42
        }
43
    }
44
 
45
    /**
46
     * Broadcast the event with the given arguments.
47
     *
48
     * @return \Illuminate\Broadcasting\PendingBroadcast
49
     */
50
    public static function broadcast()
51
    {
52
        return broadcast(new static(...func_get_args()));
53
    }
54
}