1: <?php
2:
3: /**
4: * Mapeo de la tabla Periodos
5: * @package modelos
6: * @author Fernando Salas <rfsalas@rutatec.com>
7: * @since 2016-02-23
8: */
9: class Period extends Eloquent {
10:
11: /**
12: *@string variable de tiempo en falso
13: */
14: public $timestamps = false;
15:
16: /**
17: *@string variable llave primaria utilizada en la tabla Periodos
18: */
19: protected $primaryKey = 'serial_prd';
20:
21: /**
22: *@string variable para mapeo de la tabla periodos con el nombre que le corresponde en la base de datos
23: */
24: protected $table = 'period';
25:
26: /**
27: * Establece la relacion con los años lectivos
28: *
29: * @param void
30: *
31: * @return año lectivo, serial del año lectivo
32: * @throws InvalidArgumentException
33: * @since 2016-02-24
34: * @author Fernando Salas <rfsalas@rutatec.com>
35: *
36: * @edit 2016-02-24<br />
37: * Fernando Salas <rfsalas@rutatec.com><br />
38: * documentacion del metodo<br/>
39: * #edit1
40: */
41: public function periodGroupYear() {
42: return $this->belongsTo('PeriodGroupYear', 'serial_pgy');
43: }
44:
45: /**
46: * Establece la relacion con los subperiodos
47: *
48: * @param void
49: *
50: * @return subperiodos pertenecientes al subperiodo
51: * @throws InvalidArgumentException
52: * @since 2016-02-24
53: * @author Fernando Salas <rfsalas@rutatec.com>
54: *
55: * @edit 2016-02-24<br />
56: * Fernando Salas <rfsalas@rutatec.com><br />
57: * documentacion del metodo<br/>
58: * #edit1
59: */
60: public function subPeriods() {
61: return $this->join('subperiod', 'period.serial_prd', '=', 'subperiod.serial_prd')
62: ->where('subperiod.serial_prd', '=', $this->serial_prd)
63: ->orderBy('start_date_sbp')
64: ->get();
65: }
66:
67: }
68: