NewsObserver::restored()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace FaithGen\News\Observers;
4
5
use FaithGen\News\Jobs\MessageFollowers;
6
use FaithGen\News\Jobs\ProcessImage;
7
use FaithGen\News\Jobs\S3Upload;
8
use FaithGen\News\Jobs\UploadImage;
9
use FaithGen\News\Models\News;
10
use FaithGen\SDK\Traits\FileTraits;
11
12
class NewsObserver
13
{
14
    use FileTraits;
15
16
    /**
17
     * Handle the news "created" event.
18
     *
19
     * @param News $news
20
     * @return void
21
     */
22
    public function created(News $news)
23
    {
24
        MessageFollowers::withChain([
25
            new UploadImage($news, request('image')),
26
            new ProcessImage($news),
27
            new S3Upload($news),
28
        ])
29
            ->dispatch($news);
30
    }
31
32
    /**
33
     * Handle the news "updated" event.
34
     *
35
     * @param News $news
36
     * @return void
37
     */
38
    public function updated(News $news)
0 ignored issues
show
Unused Code introduced by
The parameter $news is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
39
    {
40
        //
41
    }
42
43
    /**
44
     * Handle the news "deleted" event.
45
     *
46
     * @param News $news
47
     * @return void
48
     */
49
    public function deleted(News $news)
50
    {
51
        if ($news->image()->exists()) {
52
            $this->deleteFiles($news);
53
            $news->image()->delete();
54
        }
55
    }
56
57
    /**
58
     * Handle the news "restored" event.
59
     *
60
     * @param News $news
61
     * @return void
62
     */
63
    public function restored(News $news)
0 ignored issues
show
Unused Code introduced by
The parameter $news is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
64
    {
65
        //
66
    }
67
68
    /**
69
     * Handle the news "force deleted" event.
70
     *
71
     * @param News $news
72
     * @return void
73
     */
74
    public function forceDeleted(News $news)
0 ignored issues
show
Unused Code introduced by
The parameter $news is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
75
    {
76
        //
77
    }
78
}
79