Completed
Push — master ( 455fca...784e36 )
by Innocent
04:49
created

Discussion::getFileName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Faithgen\Discussions\Models;
4
5
use FaithGen\SDK\Models\UuidModel;
6
use FaithGen\SDK\Traits\Relationships\Belongs\BelongsToMinistryTrait;
7
use FaithGen\SDK\Traits\Relationships\Morphs\CommentableTrait;
8
use FaithGen\SDK\Traits\Relationships\Morphs\ImageableTrait;
9
use FaithGen\SDK\Traits\StorageTrait;
10
11
class Discussion extends UuidModel
12
{
13
    use BelongsToMinistryTrait;
14
    use CommentableTrait;
15
    use ImageableTrait;
16
    use StorageTrait;
17
18
    protected $table = 'fg_discussions';
19
20
    /**
21
     * Relates this discussion to models using it.
22
     *
23
     * @return \Illuminate\Database\Eloquent\Relations\MorphTo
24
     */
25
    public function discussable()
26
    {
27
        return $this->morphTo();
28
    }
29
30
    /**
31
     * The directory name for the folder holding images.
32
     *
33
     * @return string
34
     */
35
    public function filesDir()
36
    {
37
        return 'discussions';
38
    }
39
40
    /**
41
     * The name(s) of image(s).
42
     *
43
     * @return mixed
44
     */
45
    public function getFileName()
46
    {
47
        return $this->images()
48
            ->pluck('name')
49
            ->toArray();
50
    }
51
52
    /**
53
     * The dimensions the discussion images has.
54
     *
55
     * @return array
56
     */
57
    public function getImageDimensions()
58
    {
59
        return [0, 100];
60
    }
61
}
62