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