From 64f1118883e8adbb24707e3d64a6bc587e34fe16 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 9 Oct 2018 19:24:42 -0600 Subject: [PATCH] Update Media model --- app/Media.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/app/Media.php b/app/Media.php index c1d36e558..592a684a1 100644 --- a/app/Media.php +++ b/app/Media.php @@ -32,4 +32,27 @@ class Media extends Model return url($url); } + + public function mimeType() + { + return explode('/', $this->mime)[0]; + } + + public function activityVerb() + { + $verb = 'Image'; + switch ($this->mimeType()) { + case 'image': + break; + + case 'video': + $verb = 'Video'; + break; + + default: + $verb = 'Document'; + break; + } + return $verb; + } }