1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Models; |
4
|
|
|
|
5
|
|
|
use Illuminate\Database\Eloquent\Model; |
6
|
|
|
|
7
|
|
|
class Institution_staff extends Model { |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* The database table used by the model. |
11
|
|
|
* |
12
|
|
|
* @var string |
13
|
|
|
*/ |
14
|
|
|
protected $table = 'institution_staff'; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Attributes that should be mass-assignable. |
18
|
|
|
* |
19
|
|
|
* @var array |
20
|
|
|
*/ |
21
|
|
|
protected $fillable = ['FTE', 'start_date', 'start_year', 'end_date', 'end_year', 'staff_id', 'staff_type_id', 'staff_status_id', 'institution_id', 'institution_position_id', 'security_group_user_id', 'modified_user_id', 'modified', 'created_user_id', 'created', 'area_administrative_id']; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* The attributes excluded from the model's JSON form. |
25
|
|
|
* |
26
|
|
|
* @var array |
27
|
|
|
*/ |
28
|
|
|
protected $hidden = []; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* The attributes that should be casted to native types. |
32
|
|
|
* |
33
|
|
|
* @var array |
34
|
|
|
*/ |
35
|
|
|
protected $casts = []; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* The attributes that should be mutated to dates. |
39
|
|
|
* |
40
|
|
|
* @var array |
41
|
|
|
*/ |
42
|
|
|
protected $dates = ['start_date', 'end_date', 'modified', 'created']; |
43
|
|
|
|
44
|
|
|
|
45
|
|
|
public function staff_class(){ |
46
|
|
|
return $this->hasMany('App\Models\Institution_class','staff_id','staff_id') |
47
|
|
|
->innerJoin('academic_periods','institution_classes.academic_period_id','academic_periods.id') |
48
|
|
|
->where('academic_periods.current',1); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
public function institution(){ |
52
|
|
|
return $this->belongsTo('App\Models\Institution','institution_id'); |
53
|
|
|
} |
54
|
|
|
} |