1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Participante extends Model
{
use SoftDeletes;
public const ENUM_TURNO = ['Matutino', 'Vespertino', 'Noturno', 'Integral'];
protected $fillable = ['rg', 'data_de_nascimento', 'curso', 'funcao_participante_id', 'turno',
'ordem_prioridade', 'periodo_atual', 'total_periodos', 'media_do_curso', 'linkLattes',
'tipoBolsa', 'data_entrada', 'data_saida'];
public function user(){
return $this->belongsTo('App\User');
}
public function participanteSubstituido(){
return $this->hasMany('App\Substituicao');
}
public function participanteSubstituto(){
return $this->hasMany('App\Substituicao');
}
public function trabalhos(){
return $this->belongsToMany('App\Trabalho', 'trabalho_participante');
}
public function planoTrabalho() {
return $this->hasOne('App\Arquivo', 'participanteId');
}
public function documentacaoComplementar() {
return $this->hasOne('App\DocumentacaoComplementar', 'participante_id');
}
public function desligamentos() {
return $this->hasMany('App\Desligamento', 'participante_id')->orderBy('created_at', 'DESC');
}
}