diff --git a/app/View/Components/CacheImage.php b/app/View/Components/CacheImage.php new file mode 100644 index 0000000..0eaa153 --- /dev/null +++ b/app/View/Components/CacheImage.php @@ -0,0 +1,35 @@ +src = $src; + $this->alt = $alt; + $this->class = $class; + $this->width = $width; + $this->height = $height; + + $this->handleCache(); + } + + public function handleCache() + { + if (!\Cache::has($this->src)) { + $image = file_get_contents($this->src); + \Cache::put($this->src, $image, 60 * 24 * 7); + } + return \Cache::get($this->src); + } + + public function render(): View + { + return view('components.cache-image', ['src' => $this->handleCache(), 'alt' => $this->alt, 'class' => $this->class, 'width' => $this->width, 'height' => $this->height]); + } +} diff --git a/resources/views/components/cache-image.blade.php b/resources/views/components/cache-image.blade.php new file mode 100644 index 0000000..487464e --- /dev/null +++ b/resources/views/components/cache-image.blade.php @@ -0,0 +1 @@ +{{ $alt }} diff --git a/resources/views/main/cinemas/cinema.blade.php b/resources/views/main/cinemas/cinema.blade.php index eb94aa5..b415d11 100644 --- a/resources/views/main/cinemas/cinema.blade.php +++ b/resources/views/main/cinemas/cinema.blade.php @@ -19,8 +19,7 @@
@foreach($cinema->showings as $showing) - {{$showing->movie->movie_name}} Poster +
{{$showing->movie->movie_name}}
{{$showing->showing_date}}
diff --git a/resources/views/main/genres/genre.blade.php b/resources/views/main/genres/genre.blade.php index ad0af9c..7969734 100644 --- a/resources/views/main/genres/genre.blade.php +++ b/resources/views/main/genres/genre.blade.php @@ -18,7 +18,7 @@