forked from ProcessMaker/processmaker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGroupMember.php
More file actions
104 lines (98 loc) · 3.34 KB
/
GroupMember.php
File metadata and controls
104 lines (98 loc) · 3.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
namespace ProcessMaker\Models;
/**
* Represents a group Members definition.
*
* @property int $id
* @property int $group_id
* @property string $member_type
* @property int $member_id
* @property \Carbon\Carbon $updated_at
* @property \Carbon\Carbon $created_at
*
*
* @OA\Schema(
* schema="groupMembersEditable",
* @OA\Property(property="group_id", type="string", format="id"),
* @OA\Property(property="member_id", type="string", format="id"),
* @OA\Property(property="member_type", type="string"),
* @OA\Property(property="description", type="string"),
* ),
* @OA\Schema(
* schema="groupMembers",
* allOf={
* @OA\Schema(ref="#/components/schemas/groupMembersEditable"),
* @OA\Schema(
* type = "object",
* @OA\Property(property="id", type="string", format="id"),
* @OA\Property(property="created_at", type="string", format="date-time"),
* @OA\Property(property="updated_at", type="string", format="date-time"),
* )
* },
* ),
* @OA\Schema(
* schema="createGroupMembers",
* allOf={
* @OA\Schema(ref="#/components/schemas/groupMembersEditable"),
* @OA\Schema(
* type = "object",
* @OA\Property(property="id", type="string", format="id"),
* @OA\Property(property="group", type="object"),
* @OA\Property(property="member", type="object"),
* @OA\Property(property="created_at", type="string", format="date-time"),
* @OA\Property(property="updated_at", type="string", format="date-time"),
* )
* },
* ),
* @OA\Schema(
* schema="getGroupMembersById",
* allOf={
* @OA\Schema(
* type = "object",
* @OA\Property(property="group_id", type="string", format="id"),
* @OA\Property(property="member_id", type="string", format="id"),
* @OA\Property(property="member_type", type="string"),
* @OA\Property(property="id", type="string", format="id"),
* @OA\Property(property="created_at", type="string", format="date-time"),
* @OA\Property(property="updated_at", type="string", format="date-time"),
* )
* },
* ),
* @OA\Schema(
* schema="availableGroupMembers",
* allOf={
* @OA\Schema(
* type = "object",
* @OA\Property(property="id", type="string", format="id"),
* @OA\Property(property="description", type="string"),
* @OA\Property(property="name", type="string"),
* @OA\Property(property="status", type="string", enum={"ACTIVE", "INACTIVE"}),
* @OA\Property(property="created_at", type="string", format="date-time"),
* @OA\Property(property="updated_at", type="string", format="date-time"),
* )
* },
* ),
*/
class GroupMember extends ProcessMakerModel
{
protected $connection = 'processmaker';
protected $fillable = [
'group_id', 'member_id', 'member_type',
];
public static function rules()
{
return [
'group_id' => 'required',
'member_id' => 'required',
'member_type' => 'required|in:' . User::class . ',' . Group::class,
];
}
public function member()
{
return $this->morphTo(null, null, 'member_id');
}
public function group()
{
return $this->belongsTo(Group::class);
}
}