Completed
Push — master ( 6a541b...8c9cef )
by Ricardo
03:56
created

Instancia::getApresentationName()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
/**
3
 * Instancias Reais (meu pc)
4
 */
5
6
namespace Fabrica\Models\Computer;
7
8
use Fabrica\Tools\Ssh;
9
use Pedreiro\Models\Base;
10
11
class Instancia extends Base
12
{
13
    public static $apresentationName = 'Instancias';
14
15
    protected $organizationPerspective = true;
16
17
    protected $table = 'instancias';
18
19
    /**
20
     * The attributes that are mass assignable.
21
     *
22
     * @var array
23
     */
24
    protected $fillable = [
25
        'name',
26
        'status',
27
    ];
28
29
30
    protected $mappingProperties = array(
31
32
    );
33
34
    
35
    public $formFields = [
36
        [
37
            'name' => 'name',
38
            'label' => 'name',
39
            'type' => 'text'
40
        ],
41
        [
42
            'name' => 'status',
43
            'label' => 'Status',
44
            'type' => 'checkbox'
45
        ],
46
        // [
47
        //     'name' => 'status',
48
        //     'label' => 'Enter your content here',
49
        //     'type' => 'textarea'
50
        // ],
51
        // ['name' => 'publish_on', 'label' => 'Publish Date', 'type' => 'date'],
52
        // ['name' => 'category_id', 'label' => 'Category', 'type' => 'select', 'relationship' => 'category'],
53
        // ['name' => 'tags', 'label' => 'Tags', 'type' => 'select_multiple', 'relationship' => 'tags'],
54
    ];
55
56
    public $indexFields = [
57
        'name',
58
        'status'
59
    ];
60
61
    public $validationRules = [
62
        'name'       => 'required|max:255',
63
        // 'url'        => 'required|max:100',
64
        'status'        => 'boolean',
65
        // 'publish_on'  => 'date',
66
        // 'published'   => 'boolean',
67
        // 'category_id' => 'required|int',
68
    ];
69
70
    public $validationMessages = [
71
        'name.required' => "Nome é obrigatório."
72
    ];
73
74
    public $validationAttributes = [
75
        'name' => 'Name'
76
    ];
77
    
78
    public function getName()
79
    {
80
        return $this->instance;
81
    }
82
83
    public function getApresentationName()
84
    {
85
        if (!$name = $this->getName()) {
86
            return 'Vazio';
87
        }
88
        return $name;
89
    }
90
91
}
92