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

1.8 KiB

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

  • Created migration to add is_shorts boolean column to videos table

2. Video Model (app/Models/Video.php)

  • Added is_shorts to fillable array
  • Added is_shorts to casts (boolean)
  • Added helper methods: isShorts(), scopeShorts(), scopeNotShorts()
  • Added qualifiesAsShorts() for auto-detection
  • Added getFormattedDurationAttribute()
  • Added getShortsBadgeAttribute()

3. Video Controller (app/Http/Controllers/VideoController.php)

  • Updated validation to include is_shorts
  • Added auto-detection of shorts based on:
    • Duration ≤ 60 seconds
    • Portrait orientation (height > width)
  • Updated store method to include duration and is_shorts
  • Updated edit method to include is_shorts in JSON response
  • Updated update method to support is_shorts
  • Added shorts() method for shorts page

4. Views

  • Added Shorts toggle in upload form (create.blade.php)
  • Added Shorts toggle CSS styles
  • Added Shorts badge in video cards
  • Added Shorts toggle in edit modal
  • Created shorts.blade.php page
  • Updated sidebar to link to Shorts page

5. Routes

  • Added /shorts route

6. Admin

  • 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