We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 34dcc01 commit ba4f07cCopy full SHA for ba4f07c
src/HasFiles.php
@@ -15,6 +15,7 @@
15
trait HasFiles
16
{
17
use HasCustomAttributes;
18
+
19
/**
20
* Files Atrributes on Save/Create
21
*
@@ -149,7 +150,13 @@ public function isFileAttribute(string $key): bool
149
150
*/
151
public function files()
152
- return $this->morphMany(File::class, 'model');
153
+ $hasThumbnails = false;
154
155
+ foreach ($this->filesOptions ?? [] as $options)
156
+ if (isset($options['thumbnail']))
157
+ $hasThumbnails = true;
158
159
+ return $this->morphMany(File::class, 'model')->with($hasThumbnails ? 'file.thumbnail' : 'file');
160
}
161
162
0 commit comments