-
app/helpers.php
Open in GitHubif (!function_exists('isPhoto')) { function isPhoto($path) { $exploded = explode('.', $path); $ext = strtolower(end($exploded)); $photoExtensions = ['png', 'jpg', 'jpeg', 'gif', 'jfif', 'tif']; if (in_array($ext, $photoExtensions)) { return true; } return false; } } if (!function_exists('isVideo')) { function isVideo($path) { $exploded = explode('.', $path); $ext = end($exploded); $videoExtensions = ['mov', 'mp4', 'avi', 'wmf', 'flv', 'webm']; if (in_array($ext, $videoExtensions)) { return true; } return false; } }
-
resources/views/livewire/show.blade.php
Open in GitHub// @if (isPhoto($message->file)) <div class="w-100 my-2"> <img class="img-fluid rounded" loading="lazy" style="height: 250px" src="{{ $message->file }}"> </div> @elseif (isVideo($message->file)) <div class="w-100 my-2"> <video style="height: 250px" class="img-fluid rounded" controls> <source src="{{ $message->file }}"> </video> </div> @elseif ($message->file) <div class="w-100 my-2"> <a href="{{ $message->file}}" class="bg-light p-2 rounded-pill" target="_blank"><i class="fa fa-download"></i> {{ $message->file_name }} </a> </div> @endif //
-
composer.json
Open in GitHub// "autoload": { // "files": [ "app/helpers.php" ] }, //