1: <?php
2:
3: /**
4: * Mapeo de la tabla representantes
5: * @package modelos
6: * @author Fernando Salas <rfsalas@rutatec.com>
7: * @since 2016-02-23
8: */
9: class Guardian extends Eloquent {
10:
11: /**
12: * @string variable para mapeo de la tabla representante con el nombre que le corresponde en la base de datos
13: */
14: protected $table = 'guardian';
15:
16: /**
17: *@string variable llave primaria utilizada en la tabla guardian
18: */
19: protected $primaryKey = 'serial_grd';
20:
21: /**
22: *@string var de tiempo
23: */
24: public $timestamps = false;
25:
26: /**
27: * Establece la relacion con la tabla usuarios
28: *
29: * @param void
30: *
31: * @return void
32: * @throws InvalidArgumentException
33: * @since 2016-02-23
34: * @author Fernando Salas <rfsalas@rutatec.com>
35: *
36: * @edit 2016-02-23<br />
37: * Fernando Salas <rfsalas@rutatec.com><br />
38: * documentacion del metodo<br/>
39: * #edit1
40: */
41: public function user() {
42: return $this->belongsTo('User', 'serial_usr');
43: }
44:
45: /**
46: * Establece la relacion con la tabla estudiantes
47: *
48: * @param void
49: *
50: * @return void
51: * @throws InvalidArgumentException
52: * @since 2016-02-23
53: * @author Fernando Salas <rfsalas@rutatec.com>
54: *
55: * @edit 2016-02-23<br />
56: * Fernando Salas <rfsalas@rutatec.com><br />
57: * documentacion
58: * documentacion del metodo<br/>
59: * #edit1
60: */
61: public function students() {
62: return $this->belongsToMany('Student', 'student_guardian', 'serial_grd', 'serial_std')
63: ->withPivot('relationship_stg', 'legal_guardian_stg', 'economic_guardian_stg', 'status_stg')
64: ->orderBy('student.first_name_std')
65: ->orderBy('student.last_name_std');
66: }
67:
68: }
69: