# Project
app / Models / Project.php
protected $guarded = [];
protected $casts = [
'images' => 'array',
'files' => 'array',
];
public function projectLeaderInfo(){
return $this->belongsToMany( User::class,'project_leaders', 'project_id', 'user_id');
}
public function projectMemberInfo(){
return $this->belongsToMany( User::class, 'project_members','project_id', 'user_id');
}
public function taskInfo(){
return $this->hasMany(Task::class, 'project_id', 'id');
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# ProjectLeader
app / Models / ProjectLeader.php
protected $guarded = [];
1
# ProjectMember
app / Models / ProjectMember.php
protected $guarded = [];
1