forked from ProcessMaker/processmaker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMedia.php
More file actions
112 lines (104 loc) · 3.13 KB
/
Media.php
File metadata and controls
112 lines (104 loc) · 3.13 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
105
106
107
108
109
110
111
112
<?php
namespace ProcessMaker\Models;
use Spatie\MediaLibrary\Models\Media as Model;
/**
* Represents media files stored in the database
*
* @property integer 'id',
* @property integer 'model_id',
* @property string 'model_type',
* @property string 'collection_name',
* @property string 'name',
* @property string 'file_name',
* @property string 'mime_type',
* @property string 'disk',
* @property string 'size',
* @property string 'manipulations',
* @property string 'custom_properties',
* @property string 'responsive_images',
* @property string 'order_column',
* @property \Carbon\Carbon $updated_at
* @property \Carbon\Carbon $created_at
*
* @OA\Schema(
* schema="mediaEditable",
* @OA\Property(property="id", type="integer", format="id"),
* @OA\Property(property="model_id", type="integer", format="id"),
* @OA\Property(property="model_type", type="string", format="id"),
* @OA\Property(property="collection_name", type="string"),
* @OA\Property(property="name", type="string"),
* @OA\Property(property="file_name", type="string"),
* @OA\Property(property="mime_type", type="string"),
* @OA\Property(property="disk", type="string"),
* @OA\Property(property="size", type="integer"),
* @OA\Property(property="manipulations", type="string"),
* @OA\Property(property="custom_properties", type="string"),
* @OA\Property(property="responsive_images", @OA\Schema(type="array", @OA\Items(type="string"))),
* @OA\Property(property="order_column", type="integer"),
* ),
* @OA\Schema(
* schema="media",
* allOf={@OA\Schema(ref="#/components/schemas/mediaEditable")},
* @OA\Property(property="created_at", type="string", format="date-time"),
* @OA\Property(property="updated_at", type="string", format="date-time"),
* ),
* @OA\Schema(
* schema="mediaExported",
* @OA\Property(property="url", type="string"),
* )
*/
class Media extends Model
{
protected $connection = 'processmaker';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'model_id',
'model_type',
'collection_name',
'name',
'file_name',
'mime_type',
'disk',
'size',
'manipulations',
'custom_properties',
'responsive_images',
'order_column',
];
/**
* Validation rules
*
* @param $existing
*
* @return array
*/
public static function rules($existing = null)
{
return [
'model_id' => 'required',
'model_type' => 'required',
'collection_name' => 'required',
'name' => 'required,alpha_spaces',
'file_name' => 'required',
'mime_type' => 'required',
'disk' => 'required',
'size' => 'required',
'manipulations' => 'required',
'custom_properties' => 'required',
'responsive_images' => 'required',
'order_column' => 'required'
];
}
/**
* The binary UUID attributes that should be converted to text.
*
* @var array
*/
protected $ids = [
'model_id',
];
}