made the video cards components

This commit is contained in:
ghassan committed 2026-03-02 02:16:28 +03:00
1 parent 3aa49d638d
commit 72e9439727
16 files changed
+3973 -250

No files matched your search

+5 -1
View File
@@ -58,6 +58,7 @@ class VideoController extends Controller
'video' => 'required|file|mimes:mp4,webm,ogg,mov,avi,wmv,flv,mkv|max:512000',
'thumbnail' => 'nullable|image|mimes:jpg,jpeg,png,webp|max:5120',
'visibility' => 'nullable|in:public,unlisted,private',
'type' => 'nullable|in:generic,music,match',
]);
$videoFile = $request->file('video');
@@ -148,6 +149,7 @@ class VideoController extends Controller
'height' => $height,
'status' => 'processing',
'visibility' => $request->visibility ?? 'public',
'type' => $request->type ?? 'generic',
]);
// Dispatch compression job in the background
@@ -221,6 +223,7 @@ class VideoController extends Controller
'thumbnail' => $video->thumbnail,
'thumbnail_url' => $video->thumbnail ? asset('storage/thumbnails/' . $video->thumbnail) : null,
'visibility' => $video->visibility ?? 'public',
'type' => $video->type ?? 'generic',
]
]);
}
@@ -237,9 +240,10 @@ class VideoController extends Controller
'description' => 'nullable|string',
'thumbnail' => 'nullable|image|mimes:jpg,jpeg,png,webp|max:5120',
'visibility' => 'nullable|in:public,unlisted,private',
'type' => 'nullable|in:generic,music,match',
]);
$data = $request->only(['title', 'description', 'visibility']);
$data = $request->only(['title', 'description', 'visibility', 'type']);
if ($request->hasFile('thumbnail')) {
if ($video->thumbnail) {
+26
View File
@@ -21,6 +21,7 @@ class Video extends Model
'height',
'status',
'visibility',
'type',
];
protected $casts = [
@@ -137,5 +138,30 @@ class Video extends Model
}
return $query->where('visibility', '!=', 'private');
}
// Video type helpers
public function getTypeIconAttribute()
{
return match($this->type) {
'music' => 'bi-music-note',
'match' => 'bi-trophy',
default => 'bi-film',
};
}
public function isGeneric()
{
return $this->type === 'generic';
}
public function isMusic()
{
return $this->type === 'music';
}
public function isMatch()
{
return $this->type === 'match';
}
}