1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Armazena a Localização e Hierarquia de Pastas e Arquivos |
4
|
|
|
*/ |
5
|
|
|
|
6
|
|
|
namespace Fabrica\Models\Computer; |
7
|
|
|
|
8
|
|
|
use Fabrica\Tools\Ssh; |
9
|
|
|
use Pedreiro\Models\Base; |
10
|
|
|
|
11
|
|
|
class ComputerCatalog extends Base |
12
|
|
|
{ |
13
|
|
|
public static $apresentationName = 'Servidores'; |
14
|
|
|
|
15
|
|
|
protected $organizationPerspective = true; |
16
|
|
|
|
17
|
|
|
protected $table = 'computer_catalogs'; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* The attributes that are mass assignable. |
21
|
|
|
* |
22
|
|
|
* @var array |
23
|
|
|
*/ |
24
|
|
|
protected $fillable = [ |
25
|
|
|
'name', |
26
|
|
|
'type', |
27
|
|
|
'location', |
28
|
|
|
'computer_id', |
29
|
|
|
]; |
30
|
|
|
|
31
|
|
|
|
32
|
|
|
protected $mappingProperties = array( |
33
|
|
|
|
34
|
|
|
'customer_id' => [ |
35
|
|
|
'type' => 'integer', |
36
|
|
|
"analyzer" => "standard", |
37
|
|
|
], |
38
|
|
|
); |
39
|
|
|
|
40
|
|
|
|
41
|
|
|
public $formFields = [ |
42
|
|
|
[ |
43
|
|
|
'name' => 'name', |
44
|
|
|
'label' => 'name', |
45
|
|
|
'type' => 'text' |
46
|
|
|
], |
47
|
|
|
[ |
48
|
|
|
'name' => 'url', |
49
|
|
|
'label' => 'url', |
50
|
|
|
'type' => 'text' |
51
|
|
|
], |
52
|
|
|
[ |
53
|
|
|
'name' => 'ip', |
54
|
|
|
'label' => 'url', |
55
|
|
|
'type' => 'text' |
56
|
|
|
], |
57
|
|
|
[ |
58
|
|
|
'name' => 'instance', |
59
|
|
|
'label' => 'url', |
60
|
|
|
'type' => 'text' |
61
|
|
|
], |
62
|
|
|
[ |
63
|
|
|
'name' => 'status', |
64
|
|
|
'label' => 'Status', |
65
|
|
|
'type' => 'checkbox' |
66
|
|
|
], |
67
|
|
|
// [ |
68
|
|
|
// 'name' => 'status', |
69
|
|
|
// 'label' => 'Enter your content here', |
70
|
|
|
// 'type' => 'textarea' |
71
|
|
|
// ], |
72
|
|
|
// ['name' => 'publish_on', 'label' => 'Publish Date', 'type' => 'date'], |
73
|
|
|
// ['name' => 'category_id', 'label' => 'Category', 'type' => 'select', 'relationship' => 'category'], |
74
|
|
|
// ['name' => 'tags', 'label' => 'Tags', 'type' => 'select_multiple', 'relationship' => 'tags'], |
75
|
|
|
]; |
76
|
|
|
|
77
|
|
|
public $indexFields = [ |
78
|
|
|
'name', |
79
|
|
|
'url', |
80
|
|
|
'ip', |
81
|
|
|
'instance', |
82
|
|
|
'user', |
83
|
|
|
'status' |
84
|
|
|
]; |
85
|
|
|
|
86
|
|
|
public $validationRules = [ |
87
|
|
|
'name' => 'required|max:255', |
88
|
|
|
'url' => 'required|max:100', |
89
|
|
|
'status' => 'boolean', |
90
|
|
|
// 'publish_on' => 'date', |
91
|
|
|
// 'published' => 'boolean', |
92
|
|
|
// 'category_id' => 'required|int', |
93
|
|
|
]; |
94
|
|
|
|
95
|
|
|
public $validationMessages = [ |
96
|
|
|
'name.required' => "Nome é obrigatório." |
97
|
|
|
]; |
98
|
|
|
|
99
|
|
|
public $validationAttributes = [ |
100
|
|
|
'name' => 'Name' |
101
|
|
|
]; |
102
|
|
|
|
103
|
|
|
public function getName() |
104
|
|
|
{ |
105
|
|
|
return $this->instance; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
public function getApresentationName() |
109
|
|
|
{ |
110
|
|
|
if (!$name = $this->getName()) { |
111
|
|
|
return 'Vazio'; |
112
|
|
|
} |
113
|
|
|
return $name; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
public function connect() |
117
|
|
|
{ |
118
|
|
|
return new Ssh($this); |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
|
122
|
|
|
public function user() |
123
|
|
|
{ |
124
|
|
|
return $this->belongsTo(\Illuminate\Support\Facades\Config::get('sitec.core.models.user', \App\Models\User::class), 'user_id', 'id'); |
125
|
|
|
} |
126
|
|
|
} |
127
|
|
|
|