Completed
Push — master ( d5537d...bd4222 )
by Arjay
13:20
created

Theme::preview()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
3
namespace Yajra\CMS\Theme;
4
5
use Illuminate\Support\Fluent;
6
7
class Theme extends Fluent
8
{
9
    /**
10
     * @var string
11
     */
12
    public $name;
13
14
    /**
15
     * @var string
16
     */
17
    public $theme;
18
19
    /**
20
     * @var string
21
     */
22
    public $version;
23
24
    /**
25
     * @var string
26
     */
27
    public $description;
28
29
    /**
30
     * @var array
31
     */
32
    public $positions = [];
33
34
    /**
35
     * Theme constructor.
36
     *
37
     * @param string $name
38
     * @param string $theme
39
     * @param string $version
40
     * @param string $description
41
     * @param array $positions
42
     * @param array|object $attributes
43
     */
44
    public function __construct($name, $theme, $version, $description, array $positions, $attributes = [])
45
    {
46
        $this->name        = $name;
47
        $this->theme       = $theme;
48
        $this->version     = $version;
49
        $this->description = $description;
50
        $this->positions   = $positions;
51
52
        parent::__construct($attributes);
53
    }
54
55
    /**
56
     * Check if this team is the default theme.
57
     *
58
     * @return bool
59
     */
60
    public function isDefault()
61
    {
62
        return $this->theme == config('theme.frontend', 'default');
63
    }
64
65
    /**
66
     * Get theme image preview url.
67
     *
68
     * @return \Illuminate\Contracts\Routing\UrlGenerator|string
69
     */
70
    public function preview()
71
    {
72
        return url('themes/'.$this->theme.'/preview.png');
73
    }
74
}
75