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 dba1207 commit a5099b8Copy full SHA for a5099b8
src/Attachment.php
@@ -282,6 +282,23 @@ public function getUrlAttribute()
282
}
283
284
285
+ public function getUrlInlineAttribute()
286
+ {
287
+ if ($this->isLocalStorage()) {
288
+ $extension = $this->extension;
289
+
290
+ return route('attachments.download', [
291
+ 'id' => $this->uuid,
292
+ 'name' => $extension ?
293
+ Str::slug(substr($this->filename, 0, -1 * strlen($this->extension) - 1)) . '.' . $this->extension :
294
+ Str::slug($this->filename),
295
+ 'disposition' => 'inline',
296
+ ]);
297
+ } else {
298
+ return Storage::disk($this->disk)->url($this->filepath);
299
+ }
300
301
302
303
public function toArray()
304
{
@@ -572,4 +589,4 @@ public function getConnectionName()
572
589
573
590
return config('attachments.database.connection') ?? $this->connection;
574
591
575
-}
592
+}
0 commit comments