Skip to content

Commit 6832df6

Browse files
Create ResearchSpaceCollaborator.php
1 parent 188b5fa commit 6832df6

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
namespace App\Models;
4+
5+
use Illuminate\Database\Eloquent\Factories\HasFactory;
6+
use Illuminate\Database\Eloquent\Model;
7+
use Illuminate\Database\Eloquent\Relations\BelongsTo;
8+
9+
class ResearchSpaceCollaborator extends Model
10+
{
11+
use HasFactory;
12+
13+
protected $table = 'research_space_collaborators';
14+
15+
protected $fillable = [
16+
'research_space_id',
17+
'user_id',
18+
'role', // owner, admin, editor, viewer
19+
'permissions',
20+
'invited_by',
21+
'accepted_at',
22+
];
23+
24+
protected $casts = [
25+
'permissions' => 'array',
26+
'accepted_at' => 'datetime',
27+
];
28+
29+
public function researchSpace(): BelongsTo
30+
{
31+
return $this->belongsTo(ResearchSpace::class, 'research_space_id');
32+
}
33+
34+
public function user(): BelongsTo
35+
{
36+
return $this->belongsTo(User::class, 'user_id');
37+
}
38+
}

0 commit comments

Comments
 (0)