takeone-youtube-clone/TODO_shorts_implementation.md
2026-03-11 11:21:33 +03:00

52 lines
1.8 KiB
Markdown

# Shorts Feature Implementation Plan
## Overview
Add "Shorts" as a separate attribute (boolean flag) to identify short-form vertical videos, independent of the video content type (generic/music/match).
## ✅ Completed Tasks
### 1. ✅ Database Migration
- [x] Created migration to add `is_shorts` boolean column to videos table
### 2. ✅ Video Model (app/Models/Video.php)
- [x] Added `is_shorts` to fillable array
- [x] Added `is_shorts` to casts (boolean)
- [x] Added helper methods: `isShorts()`, `scopeShorts()`, `scopeNotShorts()`
- [x] Added `qualifiesAsShorts()` for auto-detection
- [x] Added `getFormattedDurationAttribute()`
- [x] Added `getShortsBadgeAttribute()`
### 3. ✅ Video Controller (app/Http/Controllers/VideoController.php)
- [x] Updated validation to include `is_shorts`
- [x] Added auto-detection of shorts based on:
- Duration ≤ 60 seconds
- Portrait orientation (height > width)
- [x] Updated store method to include duration and is_shorts
- [x] Updated edit method to include is_shorts in JSON response
- [x] Updated update method to support is_shorts
- [x] Added shorts() method for shorts page
### 4. ✅ Views
- [x] Added Shorts toggle in upload form (create.blade.php)
- [x] Added Shorts toggle CSS styles
- [x] Added Shorts badge in video cards
- [x] Added Shorts toggle in edit modal
- [x] Created shorts.blade.php page
- [x] Updated sidebar to link to Shorts page
### 5. ✅ Routes
- [x] Added /shorts route
### 6. ✅ Admin
- [x] Updated SuperAdminController to support is_shorts
## Usage
1. Users can mark videos as Shorts during upload
2. Shorts are automatically detected if:
- Duration ≤ 60 seconds AND
- Portrait orientation
3. Shorts have a red badge on video cards
4. Dedicated /shorts page shows all Shorts videos
5. Sidebar has a link to Shorts