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 = '') |
||
59 | |||
60 | /** |
||
61 | * Get the original full Url to a media-file. |
||
62 | * |
||
63 | * @param string $conversionName |
||
64 | * |
||
65 | * @return string |
||
66 | * |
||
67 | * @throws \Spatie\MediaLibrary\Exceptions\UnknownConversion |
||
68 | */ |
||
69 | public function getFullUrl($conversionName = '') |
||
75 | |||
76 | /** |
||
77 | * Get the original path to a media-file. |
||
78 | * |
||
79 | * @param string $conversionName |
||
80 | * |
||
81 | * @return string |
||
82 | * |
||
83 | * @throws \Spatie\MediaLibrary\Exceptions\UnknownConversion |
||
84 | */ |
||
85 | public function getPath($conversionName = '') |
||
91 | |||
92 | /** |
||
93 | * Determine the type of a file. |
||
94 | * |
||
95 | * @return string |
||
96 | */ |
||
97 | public function getTypeAttribute() |
||
106 | |||
107 | /** |
||
108 | * Determine the type of a file from its file extension |
||
109 | * |
||
110 | * @return string |
||
111 | */ |
||
112 | public function getTypeFromExtensionAttribute() |
||
126 | |||
127 | /** |
||
128 | * Determine the type of a file from its mime type |
||
129 | * |
||
130 | * @return string |
||
131 | */ |
||
132 | public function getTypeFromMimeAttribute() |
||
146 | |||
147 | /** |
||
148 | * @return string |
||
149 | */ |
||
150 | public function getExtensionAttribute() |
||
154 | |||
155 | /** |
||
156 | * @return string |
||
157 | */ |
||
158 | public function getHumanReadableSizeAttribute() |
||
162 | |||
163 | /** |
||
164 | * @return string |
||
165 | */ |
||
166 | public function getDiskDriverName() |
||
170 | |||
171 | /** |
||
172 | * Determine if the media item has a custom property with the given name. |
||
173 | * |
||
174 | * @param string $propertyName |
||
175 | * |
||
176 | * @return bool |
||
177 | */ |
||
178 | public function hasCustomProperty($propertyName) |
||
182 | |||
183 | /** |
||
184 | * Get if the value of custom property with the given name. |
||
185 | * |
||
186 | * @param string $propertyName |
||
187 | * @param mixed $propertyName |
||
188 | * |
||
189 | * @return mixed |
||
190 | */ |
||
191 | public function getCustomProperty($propertyName, $default = null) |
||
199 | |||
200 | public function setCustomProperty($name, $value) |
||
204 | |||
205 | /** |
||
206 | * Get the UrlGenerator instance. |
||
207 | * |
||
208 | * @param $conversionName |
||
209 | * |
||
210 | * @return \Spatie\MediaLibrary\UrlGenerator\UrlGenerator |
||
211 | * |
||
212 | * @throws \Spatie\MediaLibrary\Exceptions\UnknownConversion |
||
213 | */ |
||
214 | protected function getUrlGenerator($conversionName) |
||
224 | } |
||
225 |
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.