1 | <?php |
||
10 | class Person extends Base// implements \Spatie\MediaLibrary\HasMedia |
||
11 | { |
||
12 | use AsHuman; |
||
13 | |||
14 | protected $table = 'persons'; |
||
15 | |||
16 | public $incrementing = false; |
||
17 | protected $casts = [ |
||
18 | 'code' => 'string', |
||
19 | ]; |
||
20 | protected $primaryKey = 'code'; |
||
21 | protected $keyType = 'string'; |
||
22 | |||
23 | /** |
||
24 | * The attributes that are mass assignable. |
||
25 | * |
||
26 | * @var array |
||
27 | */ |
||
28 | protected $fillable = [ |
||
29 | 'code', |
||
30 | 'name', |
||
31 | 'cpf', |
||
32 | 'birthday' |
||
33 | ]; |
||
34 | |||
35 | public $formFields = [ |
||
36 | [ |
||
37 | 'name' => 'name', |
||
38 | 'label' => 'name', |
||
39 | 'type' => 'text' |
||
40 | ], |
||
41 | [ |
||
42 | 'name' => 'cpf', |
||
43 | 'label' => 'cpf', |
||
44 | 'type' => 'text' |
||
45 | ], |
||
46 | [ |
||
47 | 'name' => 'birthday', |
||
48 | 'label' => 'birthday', |
||
49 | 'type' => 'text' |
||
50 | ], |
||
51 | // [ |
||
52 | // 'name' => 'slug', |
||
53 | // 'label' => 'slug', |
||
54 | // 'type' => 'text' |
||
55 | // ], |
||
56 | // [ |
||
57 | // 'name' => 'status', |
||
58 | // 'label' => 'Status', |
||
59 | // 'type' => 'checkbox' |
||
60 | // ], |
||
61 | // [ |
||
62 | // 'name' => 'status', |
||
63 | // 'label' => 'Enter your content here', |
||
64 | // 'type' => 'textarea' |
||
65 | // ], |
||
66 | // ['name' => 'publish_on', 'label' => 'Publish Date', 'type' => 'date'], |
||
67 | // ['name' => 'category_id', 'label' => 'Category', 'type' => 'select', 'relationship' => 'category'], |
||
68 | // ['name' => 'tags', 'label' => 'Tags', 'type' => 'select_multiple', 'relationship' => 'tags'], |
||
69 | ]; |
||
70 | |||
71 | public $indexFields = [ |
||
72 | 'name', |
||
73 | 'cpf', |
||
74 | 'birthday', |
||
75 | // 'slug', |
||
76 | // 'status' |
||
77 | ]; |
||
78 | |||
79 | public $validationRules = [ |
||
80 | 'name' => 'required|max:255', |
||
81 | 'cpf' => 'required|max:100', |
||
82 | // 'slug' => 'required|max:100', |
||
83 | // 'status' => 'boolean', |
||
84 | // 'publish_on' => 'date', |
||
85 | // 'published' => 'boolean', |
||
86 | // 'category_id' => 'required|int', |
||
87 | ]; |
||
88 | |||
89 | public $validationMessages = [ |
||
90 | 'name.required' => "Nome é obrigatório." |
||
91 | ]; |
||
92 | |||
93 | public $validationAttributes = [ |
||
94 | 'name' => 'Name' |
||
95 | ]; |
||
96 | |||
97 | protected $mappingProperties = array( |
||
98 | /** |
||
99 | * User Info |
||
100 | */ |
||
101 | 'name' => [ |
||
102 | 'type' => 'string', |
||
103 | "analyzer" => "standard", |
||
104 | ], |
||
105 | 'cpf' => [ |
||
106 | 'type' => 'string', |
||
107 | "analyzer" => "standard", |
||
108 | ], |
||
109 | 'email' => [ |
||
110 | 'type' => 'string', |
||
111 | "analyzer" => "standard", |
||
112 | ], |
||
113 | |||
114 | /** |
||
115 | * Grupo de Usuário: |
||
116 | * |
||
117 | * 3 -> Usuário de Produtora |
||
118 | * Default: 3 |
||
119 | */ |
||
120 | 'role_id' => [ |
||
121 | 'type' => 'string', |
||
122 | "analyzer" => "standard", |
||
123 | ], |
||
124 | ); |
||
125 | |||
126 | public function users() |
||
130 | |||
131 | public static function boot() |
||
140 | } |
||
141 |