1 | <?php |
||
10 | class Media extends Model |
||
11 | { |
||
12 | use SortableTrait; |
||
13 | |||
14 | const TYPE_OTHER = 'other'; |
||
15 | const TYPE_IMAGE = 'image'; |
||
16 | const TYPE_PDF = 'pdf'; |
||
17 | |||
18 | protected $guarded = ['id', 'disk', 'file_name', 'size', 'model_type', 'model_id']; |
||
19 | |||
20 | public $imageProfileUrls = []; |
||
21 | |||
22 | public $hasModifiedManipulations = false; |
||
23 | |||
24 | /** |
||
25 | * The attributes that should be casted to native types. |
||
26 | * |
||
27 | * @var array |
||
28 | */ |
||
29 | protected $casts = [ |
||
30 | 'manipulations' => 'array', |
||
31 | 'custom_properties' => 'array', |
||
32 | ]; |
||
33 | |||
34 | /** |
||
35 | * Create the polymorphic relation. |
||
36 | * |
||
37 | * @return \Illuminate\Database\Eloquent\Relations\MorphTo |
||
38 | */ |
||
39 | public function model() |
||
43 | |||
44 | /** |
||
45 | * Get the original Url to a media-file. |
||
46 | * |
||
47 | * @param string $conversionName |
||
48 | * |
||
49 | * @return string |
||
50 | * |
||
51 | * @throws \Spatie\MediaLibrary\Exceptions\UnknownConversion |
||
52 | */ |
||
53 | public function getUrl($conversionName = '') |
||
63 | |||
64 | /** |
||
65 | * Get the original path to a media-file. |
||
66 | * |
||
67 | * @param string $conversionName |
||
68 | * |
||
69 | * @return string |
||
70 | * |
||
71 | * @throws \Spatie\MediaLibrary\Exceptions\UnknownConversion |
||
72 | */ |
||
73 | public function getPath($conversionName = '') |
||
83 | |||
84 | /** |
||
85 | * Determine the type of a file. |
||
86 | * |
||
87 | * @return string |
||
88 | */ |
||
89 | public function getTypeAttribute() |
||
98 | |||
99 | /** |
||
100 | * Determine the type of a file from its file extension |
||
101 | * |
||
102 | * @return string |
||
103 | */ |
||
104 | public function getTypeFromExtensionAttribute() |
||
118 | |||
119 | /** |
||
120 | * Determine the type of a file from its mime type |
||
121 | * |
||
122 | * @return string |
||
123 | */ |
||
124 | public function getTypeFromMimeAttribute() |
||
138 | |||
139 | /** |
||
140 | * @return string |
||
141 | */ |
||
142 | public function getExtensionAttribute() |
||
146 | |||
147 | /** |
||
148 | * @return string |
||
149 | */ |
||
150 | public function getHumanReadableSizeAttribute() |
||
154 | |||
155 | /** |
||
156 | * @return string |
||
157 | */ |
||
158 | public function getDiskDriverName() |
||
162 | |||
163 | /** |
||
164 | * Determine if the media item has a custom property with the given name. |
||
165 | * |
||
166 | * @param string $propertyName |
||
167 | * |
||
168 | * @return bool |
||
169 | */ |
||
170 | public function hasCustomProperty($propertyName) |
||
174 | |||
175 | /** |
||
176 | * Get if the value of custom property with the given name. |
||
177 | * |
||
178 | * @param string $propertyName |
||
179 | * @param mixed $propertyName |
||
180 | * |
||
181 | * @return mixed |
||
182 | */ |
||
183 | public function getCustomProperty($propertyName, $default = null) |
||
191 | |||
192 | public function setCustomProperty($name, $value) |
||
196 | } |
||
197 |
Since your code implements the magic setter
_set
, this function will be called for any write access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.