Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

hbakouane/admin-user-chatting

70 stars
3 code files
View hbakouane/admin-user-chatting on GitHub

app/helpers.php

Open in GitHub
if (!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"
]
},
//

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.