@@ 16-86 (lines=71) @@ | ||
13 | * |
|
14 | * @package Acacha\Users\Events |
|
15 | */ |
|
16 | class ProgressBarStatusHasBeenUpdated implements ShouldBroadcast |
|
17 | { |
|
18 | use Dispatchable, InteractsWithSockets, SerializesModels; |
|
19 | ||
20 | /** |
|
21 | * Id of progress bar to update. |
|
22 | * |
|
23 | * @var |
|
24 | */ |
|
25 | public $id; |
|
26 | ||
27 | /** |
|
28 | * Current progress var value. |
|
29 | * |
|
30 | * @var |
|
31 | */ |
|
32 | public $progress; |
|
33 | ||
34 | /** |
|
35 | * Message to show in progress bar. |
|
36 | * |
|
37 | * @var |
|
38 | */ |
|
39 | public $message; |
|
40 | ||
41 | /** |
|
42 | * Broadcast channel name. |
|
43 | * |
|
44 | * @var string |
|
45 | */ |
|
46 | protected $channelName = 'progress-bar'; |
|
47 | ||
48 | /** |
|
49 | * @return string |
|
50 | */ |
|
51 | public function getChannelName() |
|
52 | { |
|
53 | return $this->channelName; |
|
54 | } |
|
55 | ||
56 | /** |
|
57 | * @param string $channelName |
|
58 | */ |
|
59 | public function setChannelName($channelName) |
|
60 | { |
|
61 | $this->channelName = $channelName; |
|
62 | } |
|
63 | ||
64 | /** |
|
65 | * ProgressBarStatusHasBeenUpdated constructor. |
|
66 | * |
|
67 | * @param $progress |
|
68 | * @param $message |
|
69 | */ |
|
70 | public function __construct($id, $progress, $message) |
|
71 | { |
|
72 | $this->id = $id; |
|
73 | $this->progress = $progress; |
|
74 | $this->message = $message; |
|
75 | } |
|
76 | ||
77 | /** |
|
78 | * Get the channels the event should broadcast on. |
|
79 | * |
|
80 | * @return Channel|array |
|
81 | */ |
|
82 | public function broadcastOn() |
|
83 | { |
|
84 | return new Channel($this->channelName); |
|
85 | } |
|
86 | } |
|
87 |
@@ 16-96 (lines=81) @@ | ||
13 | * |
|
14 | * @package Acacha\Users\Events |
|
15 | */ |
|
16 | class UserHasBeenMigrated implements ShouldBroadcast |
|
17 | { |
|
18 | use Dispatchable, InteractsWithSockets, SerializesModels; |
|
19 | ||
20 | /** |
|
21 | * Source user id. |
|
22 | * |
|
23 | * @var |
|
24 | */ |
|
25 | public $sourceUserId; |
|
26 | ||
27 | /** |
|
28 | * Source user. |
|
29 | * |
|
30 | * @var |
|
31 | */ |
|
32 | public $sourceUser; |
|
33 | ||
34 | /** |
|
35 | * New user. |
|
36 | * |
|
37 | * @var |
|
38 | */ |
|
39 | public $newUser; |
|
40 | ||
41 | /** |
|
42 | * User migration batch id. |
|
43 | * |
|
44 | * @var |
|
45 | */ |
|
46 | public $user_migration_batch_id; |
|
47 | ||
48 | /** |
|
49 | * Broadcast channel name. |
|
50 | * |
|
51 | * @var string |
|
52 | */ |
|
53 | protected $channelName = 'users-migration'; |
|
54 | ||
55 | /** |
|
56 | * @return string |
|
57 | */ |
|
58 | public function getChannelName() |
|
59 | { |
|
60 | return $this->channelName; |
|
61 | } |
|
62 | ||
63 | /** |
|
64 | * @param string $channelName |
|
65 | */ |
|
66 | public function setChannelName($channelName) |
|
67 | { |
|
68 | $this->channelName = $channelName; |
|
69 | } |
|
70 | ||
71 | /** |
|
72 | * UserHasBeenMigrated constructor. |
|
73 | * |
|
74 | * @param $sourceUserId |
|
75 | * @param $sourceUser |
|
76 | * @param $newUser |
|
77 | * @param $user_migration_batch_id |
|
78 | */ |
|
79 | public function __construct($sourceUserId, $sourceUser, $newUser, $user_migration_batch_id) |
|
80 | { |
|
81 | $this->sourceUserId = $sourceUserId; |
|
82 | $this->sourceUser = $sourceUser; |
|
83 | $this->newUser = $newUser; |
|
84 | $this->user_migration_batch_id = $user_migration_batch_id; |
|
85 | } |
|
86 | ||
87 | /** |
|
88 | * Get the channels the event should broadcast on. |
|
89 | * |
|
90 | * @return Channel|array |
|
91 | */ |
|
92 | public function broadcastOn() |
|
93 | { |
|
94 | return new Channel($this->channelName); |
|
95 | } |
|
96 | } |
|
97 |