Passed
Push — main ( 7edd23...391368 )
by ikechukwu
02:50
created

SavedFilesIntoDB::broadcastOn()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Ikechukwukalu\Clamavfileupload\Events;
4
5
use Ikechukwukalu\Clamavfileupload\Models\FileUpload as FileUploadModel;
6
use Illuminate\Broadcasting\Channel;
7
use Illuminate\Broadcasting\InteractsWithSockets;
8
use Illuminate\Broadcasting\PresenceChannel;
9
use Illuminate\Broadcasting\PrivateChannel;
10
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
11
use Illuminate\Database\Eloquent\Collection as EloquentCollection;
12
use Illuminate\Foundation\Events\Dispatchable;
13
use Illuminate\Queue\SerializesModels;
14
15
class SavedFilesIntoDB
16
{
17
    use Dispatchable, InteractsWithSockets, SerializesModels;
0 ignored issues
show
introduced by
The trait Illuminate\Queue\SerializesModels requires some properties which are not provided by Ikechukwukalu\Clamavfile...Events\SavedFilesIntoDB: $collectionClass, $id, $relations, $class, $connection, $keyBy
Loading history...
18
19
    public FileUploadModel|EloquentCollection $files;
20
    public string $ref;
21
22
    /**
23
     * Create a new event instance.
24
     *
25
     * @param  FileUploadModel|EloquentCollection $files
26
     * @param  string  $ref
27
     */
28
    public function __construct(FileUploadModel|EloquentCollection $files, string $ref)
29
    {
30
        $this->files = $files;
31
        $this->ref = $ref;
32
    }
33
34
    /**
35
     * Get the channels the event should broadcast on.
36
     *
37
     * @return array<int, \Illuminate\Broadcasting\Channel>
38
     */
39
    public function broadcastOn(): array
40
    {
41
        return [
42
            new PrivateChannel('channel-name'),
43
        ];
44
    }
45
}
46