Skip to content

Commit

Permalink
Use caching for do_public bucket, have gallery use digitalocean (cach…
Browse files Browse the repository at this point in the history
…ed) link instead of internal route
  • Loading branch information
cholladay0816 committed Sep 6, 2023
1 parent 401a39c commit 68cc8e1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions app/Models/Gallery.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,10 @@
class Gallery extends File
{
protected $identifier = 'gallery';


public function getUrl()
{
return Storage::url($this->path);
}
}
4 changes: 2 additions & 2 deletions config/filesystems.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@
'use_path_style_endpoint' => env('DO_USE_PATH_STYLE_ENDPOINT', false),
'root' => env('DO_FOLDER') . '/public',
'visibility' => 'public',
],

'options' => ['CacheControl' => 'max-age=604800, public']
],
],

/*
Expand Down
4 changes: 2 additions & 2 deletions resources/views/livewire/gallery/gallery.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<li class="relative">
<div class="group block w-full aspect-w-10 aspect-h-7 rounded-lg bg-gray-100 focus-within:ring-2 focus-within:ring-offset-2 focus-within:ring-offset-gray-100 focus-within:ring-sky-500 overflow-hidden">
<img src="{{route('gallery.show', $gallery)}}" alt="" class="object-cover pointer-events-none group-hover:opacity-75">
<a target="_blank" href="{{route('gallery.show', $gallery)}}" class="absolute inset-0 focus:outline-none">
<img src="{{ $gallery->getUrl() }}" alt="" class="object-cover pointer-events-none group-hover:opacity-75">
<a target="_blank" href="{{ $gallery->getUrl() }}" class="absolute inset-0 focus:outline-none">
<span class="sr-only">View details for {{ $gallery->getSlug() }}</span>
</a>
</div>
Expand Down

0 comments on commit 68cc8e1

Please sign in to comment.