1 | <?php |
||
33 | class Group extends Model |
||
34 | { |
||
35 | /** |
||
36 | * The database table used by the model. |
||
37 | * |
||
38 | * @var string |
||
39 | */ |
||
40 | protected $table = 'groups'; |
||
41 | |||
42 | /** |
||
43 | * The attributes that are mass assignable. |
||
44 | * |
||
45 | * @var array |
||
46 | */ |
||
47 | protected $fillable = ['name', 'description', 'planner_id']; |
||
48 | |||
49 | /** |
||
50 | * @var array |
||
51 | */ |
||
52 | protected $hidden = ['planner', 'pivot']; |
||
53 | |||
54 | /** |
||
55 | * @var array |
||
56 | */ |
||
57 | protected $appends = ['planner_name']; |
||
58 | |||
59 | 28 | public function getPlannerNameAttribute() |
|
65 | |||
66 | /** |
||
67 | * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany |
||
68 | */ |
||
69 | 14 | public function employees() |
|
70 | { |
||
71 | 14 | return $this->belongsToMany(Employee::class); |
|
72 | } |
||
73 | |||
74 | /** |
||
75 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
76 | */ |
||
77 | 34 | public function planner() |
|
81 | |||
82 | /** |
||
83 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
84 | */ |
||
85 | public function company() |
||
89 | } |
||
90 |