1 | <?php |
||
34 | class Group extends Model |
||
35 | { |
||
36 | /** |
||
37 | * The attributes that are mass assignable. |
||
38 | * |
||
39 | * @var array |
||
40 | */ |
||
41 | protected $fillable = ['name', 'description', 'planner_id']; |
||
42 | |||
43 | /** |
||
44 | * @var array |
||
45 | */ |
||
46 | protected $hidden = ['planner', 'pivot']; |
||
47 | |||
48 | /** |
||
49 | * @var array |
||
50 | */ |
||
51 | protected $appends = ['planner_name']; |
||
52 | |||
53 | 34 | public function getPlannerNameAttribute() |
|
54 | { |
||
55 | 34 | if(is_object($this->planner) && $this->planner->exists) |
|
56 | 34 | return $this->planner->name; |
|
57 | return null; |
||
58 | } |
||
59 | |||
60 | /** |
||
61 | * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany |
||
62 | */ |
||
63 | 30 | public function employees() |
|
67 | |||
68 | /** |
||
69 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
70 | */ |
||
71 | 84 | public function planner() |
|
75 | |||
76 | /** |
||
77 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
78 | */ |
||
79 | public function company() |
||
83 | |||
84 | 56 | public function meetings() |
|
88 | } |
||
89 |