forked from ProcessMaker/processmaker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProcessPermission.php
More file actions
65 lines (58 loc) · 1.79 KB
/
ProcessPermission.php
File metadata and controls
65 lines (58 loc) · 1.79 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
<?php
namespace ProcessMaker\Models;
use ProcessMaker\Traits\SerializeToIso8601;
/**
* Represents a Process permission.
*
* @property int $id
* @property int $process_id
* @property int $permission_id
* @property int $assignable_id
* @property string $assignable_type
* @property \Carbon\Carbon $updated_at
* @property \Carbon\Carbon $created_at
*
* @OA\Schema(
* schema="processPermissionsEditable",
* @OA\Property(property="id", type="integer", format="id"),
* @OA\Property(property="process_id", type="integer", format="id"),
* @OA\Property(property="permission_id", type="integer", format="id"),
* @OA\Property(property="assignable_id", type="integer", format="id"),
* @OA\Property(property="assignable_type", type="string"),
* ),
* @OA\Schema(
* schema="processPermissions",
* allOf={@OA\Schema(ref="#/components/schemas/processPermissionsEditable")},
* @OA\Property(property="created_at", type="string", format="date-time"),
* @OA\Property(property="updated_at", type="string", format="date-time"),
* )
*/
class ProcessPermission extends ProcessMakerModel
{
use SerializeToIso8601;
protected $connection = 'processmaker';
protected $fillable = [
'process_id',
'permission_id',
'assignable_id',
'assignable_type',
];
public function assignable()
{
return $this->morphTo(null, null, 'assignable_id');
}
/**
* Validation rules.
*
* @return array
*/
public static function rules()
{
return [
'process_id' => 'nullable|exists:processes,id',
'permission_id' => 'nullable|exists:permissions,id',
'assignable_id' => 'required',
'assignable_type' => 'required|in:' . User::class . ',' . Group::class,
];
}
}