Add video platform features: authentication, video management, user profiles, likes/views tracking

- Added authentication controllers (Login, Register)
- Added UserController for user profile management
- Added VideoController with full CRUD operations
- Added Video model with relationships (user, likes, views)
- Added User model enhancements (avatar, video relationships)
- Added database migrations for video_likes, video_views, user_avatar, video_visibility
- Added CompressVideoJob for video processing
- Added VideoUploaded mail notification
- Added authentication routes
- Updated web routes with video and user routes
- Added layout templates (app, plain, partials)
- Added user views (profile, settings, channel, history, liked)
- Added video views (create, edit, index, show)
- Added email templates
This commit is contained in:
ghassan committed 2026-02-25 00:03:02 +00:00
1 parent 6a2026df4b
commit 5253f89b63
35 files changed
+5092 -849

No files matched your search

+162 -436
View File
@@ -1,237 +1,32 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>TAKEONE | Video Gallery</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css">
@extends('layouts.app')
@section('title', isset($query) ? 'Search: ' . $query . ' | TAKEONE' : 'Video Gallery | TAKEONE')
@section('extra_styles')
<style>
:root {
--brand-red: #e61e1e;
--bg-dark: #0f0f0f;
--bg-secondary: #1e1e1e;
--border-color: #303030;
--text-primary: #f1f1f1;
--text-secondary: #aaaaaa;
}
* { box-sizing: border-box; }
body {
background-color: var(--bg-dark);
color: var(--text-primary);
font-family: "Roboto", "Arial", sans-serif;
margin: 0;
padding: 0;
overflow-x: hidden;
}
/* Header */
.yt-header {
position: fixed;
top: 0;
left: 0;
right: 0;
height: 56px;
background: var(--bg-dark);
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 16px;
z-index: 1000;
border-bottom: 1px solid var(--border-color);
}
.yt-header-left {
display: flex;
align-items: center;
gap: 16px;
}
.yt-menu-btn {
width: 40px;
height: 40px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: background 0.2s;
background: transparent;
border: none;
color: var(--text-primary);
}
.yt-menu-btn:hover { background: var(--border-color); }
.yt-logo {
display: flex;
align-items: center;
text-decoration: none;
gap: 4px;
}
.yt-logo-text {
font-size: 1.4rem;
font-weight: 700;
color: var(--text-primary);
letter-spacing: -1px;
}
/* Search */
.yt-header-center {
flex: 1;
max-width: 640px;
margin: 0 40px;
display: flex;
}
.yt-search {
flex: 1;
display: flex;
height: 40px;
}
.yt-search-input {
flex: 1;
background: #121212;
border: 1px solid var(--border-color);
border-right: none;
border-radius: 20px 0 0 20px;
padding: 0 16px;
color: var(--text-primary);
font-size: 16px;
}
.yt-search-input:focus {
outline: none;
border-color: #1c62b9;
}
.yt-search-btn {
width: 64px;
background: #222;
border: 1px solid var(--border-color);
border-radius: 0 20px 20px 0;
color: var(--text-primary);
cursor: pointer;
}
.yt-search-btn:hover { background: #303030; }
.yt-search-voice {
width: 40px;
height: 40px;
border-radius: 50%;
/* Search info */
.search-info {
margin-bottom: 20px;
padding: 16px;
background: var(--bg-secondary);
border: none;
color: var(--text-primary);
margin-left: 8px;
cursor: pointer;
border-radius: 12px;
}
/* Header Right */
.yt-header-right {
display: flex;
align-items: center;
gap: 8px;
.search-info h2 {
font-size: 20px;
margin: 0;
}
.yt-icon-btn {
width: 40px;
height: 40px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
background: transparent;
border: none;
color: var(--text-primary);
font-size: 1.2rem;
}
.yt-icon-btn:hover { background: var(--border-color); }
.yt-user-avatar {
width: 32px;
height: 32px;
border-radius: 50%;
background: #555;
cursor: pointer;
}
/* Sidebar */
.yt-sidebar {
position: fixed;
top: 56px;
left: 0;
bottom: 0;
width: 240px;
background: var(--bg-dark);
overflow-y: auto;
padding: 12px;
transition: transform 0.3s;
z-index: 999;
}
.yt-sidebar-section {
padding-bottom: 12px;
border-bottom: 1px solid var(--border-color);
margin-bottom: 12px;
}
.yt-sidebar-link {
display: flex;
align-items: center;
gap: 20px;
padding: 0 12px;
height: 40px;
border-radius: 10px;
color: var(--text-primary);
text-decoration: none;
cursor: pointer;
transition: background 0.2s;
}
.yt-sidebar-link:hover { background: var(--border-color); }
.yt-sidebar-link.active {
background: var(--border-color);
font-weight: 500;
}
.yt-sidebar-link i { font-size: 1.2rem; }
/* Mobile sidebar overlay */
.yt-sidebar-overlay {
position: fixed;
top: 56px;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,0.5);
z-index: 998;
display: none;
}
.yt-sidebar-overlay.show { display: block; }
/* Main Content */
.yt-main {
margin-top: 56px;
margin-left: 240px;
padding: 24px;
min-height: calc(100vh - 56px);
transition: margin-left 0.3s;
.search-info p {
color: var(--text-secondary);
margin: 8px 0 0;
}
/* Video Grid */
.yt-video-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 20px;
grid-template-columns: repeat(3, 1fr);
gap: 24px;
}
.yt-video-card {
@@ -250,6 +45,25 @@
width: 100%;
height: 100%;
object-fit: cover;
position: absolute;
top: 0;
left: 0;
}
.yt-video-thumb video {
width: 100%;
height: 100%;
object-fit: contain;
position: absolute;
top: 0;
left: 0;
opacity: 0;
transition: opacity 0.3s ease;
background: #000;
}
.yt-video-thumb video.active {
opacity: 1;
}
.yt-video-duration {
@@ -306,7 +120,6 @@
/* More button */
.yt-more-btn {
opacity: 0;
background: transparent;
border: none;
color: var(--text-primary);
@@ -315,8 +128,6 @@
border-radius: 50%;
}
.yt-video-card:hover .yt-more-btn { opacity: 1; }
.yt-more-dropdown {
background: var(--bg-secondary);
border: 1px solid var(--border-color);
@@ -363,237 +174,152 @@
margin-bottom: 20px;
}
/* Upload Button */
.yt-upload-btn {
background: var(--brand-red);
color: white;
border: none;
padding: 8px 16px;
border-radius: 20px;
font-weight: 500;
display: flex;
align-items: center;
gap: 8px;
cursor: pointer;
text-decoration: none;
}
.yt-upload-btn:hover { background: #cc1a1a; }
n /* Mobile circle button */
@media (max-width: 576px) {
.yt-upload-btn {
width: 40px;
height: 40px;
padding: 0;
border-radius: 50%;
justify-content: center;
}
.yt-upload-btn span { display: none; }
}
/* Responsive */
@media (max-width: 1300px) {
@media (max-width: 1200px) {
.yt-video-grid {
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
grid-template-columns: repeat(3, 1fr);
gap: 20px;
}
}
@media (max-width: 991px) {
.yt-sidebar {
transform: translateX(-100%);
@media (max-width: 992px) {
.yt-video-grid {
grid-template-columns: repeat(2, 1fr);
}
.yt-sidebar.open {
transform: translateX(0);
}
.yt-main {
margin-left: 0;
}
.yt-search-voice { display: none; }
}
@media (max-width: 768px) {
.yt-header-center { display: none; }
.yt-video-grid { grid-template-columns: 1fr 1fr; gap: 16px; }
.yt-main { padding: 16px; }
}
@media (max-width: 480px) {
.yt-video-grid { grid-template-columns: 1fr; }
@media (max-width: 576px) {
.yt-video-grid {
grid-template-columns: 1fr;
}
.yt-header-right .yt-icon-btn:not(:last-child) { display: none; }
}
/* Mobile Search */
.mobile-search {
display: none;
padding: 10px 16px;
border-bottom: 1px solid var(--border-color);
}
@media (max-width: 991px) {
.mobile-search { display: block; }
}
</style>
</head>
<body>
<!-- Header -->
<header class="yt-header">
<div class="yt-header-left">
<button class="yt-menu-btn" onclick="toggleSidebar()">
<i class="bi bi-list fs-5"></i>
</button>
<a href="/videos" class="yt-logo">
<span class="yt-logo-text">TAKEONE</span>
</a>
@endsection
@section('content')
@isset($query)
<div class="search-info">
<h2>Search results for "{{ $query }}"</h2>
<p>{{ $videos->total() }} videos found</p>
</div>
<div class="yt-header-center d-none d-md-flex">
<div class="yt-search">
<input type="text" class="yt-search-input" placeholder="Search">
<button class="yt-search-btn">
<i class="bi bi-search"></i>
</button>
</div>
<button class="yt-search-voice">
<i class="bi bi-mic-fill"></i>
</button>
</div>
<div class="yt-header-right">
<a href="/videos/create" class="yt-upload-btn">
<i class="bi bi-plus-lg"></i>
<span>Upload</span>
</a>
<a href="/videos/create" class="yt-icon-btn d-sm-none">
<i class="bi bi-plus-lg"></i>
</a>
<button class="yt-icon-btn d-none d-sm-block">
<i class="bi bi-bell"></i>
</button>
<img src="https://i.pravatar.cc/150?u=user" class="yt-user-avatar" alt="User">
</div>
</header>
@endif
<!-- Sidebar Overlay (Mobile) -->
<div class="yt-sidebar-overlay" onclick="toggleSidebar()"></div>
<!-- Sidebar -->
<nav class="yt-sidebar" id="sidebar">
<div class="yt-sidebar-section">
<a href="/videos" class="yt-sidebar-link active">
<i class="bi bi-house-door-fill"></i>
<span>Home</span>
</a>
<a href="#" class="yt-sidebar-link">
<i class="bi bi-play-btn"></i>
<span>Shorts</span>
</a>
<a href="#" class="yt-sidebar-link">
<i class="bi bi-collection-play"></i>
<span>Subscriptions</span>
</a>
</div>
<div class="yt-sidebar-section">
<a href="#" class="yt-sidebar-link">
<i class="bi bi-person-video"></i>
<span>Your Channel</span>
</a>
<a href="#" class="yt-sidebar-link">
<i class="bi bi-clock-history"></i>
<span>History</span>
</a>
<a href="#" class="yt-sidebar-link">
<i class="bi bi-hand-thumbs-up"></i>
<span>Liked Videos</span>
</a>
</div>
</nav>
<!-- Main Content -->
<main class="yt-main" id="main">
<!-- Mobile Search -->
<div class="mobile-search">
<div class="yt-search">
<input type="text" class="yt-search-input" placeholder="Search">
<button class="yt-search-btn">
<i class="bi bi-search"></i>
</button>
</div>
</div>
@if($videos->isEmpty())
<div class="yt-empty">
<i class="bi bi-camera-video yt-empty-icon"></i>
@if($videos->isEmpty())
<div class="yt-empty">
<i class="bi bi-camera-video yt-empty-icon"></i>
@isset($query)
<h2 class="yt-empty-title">No results found</h2>
<p class="yt-empty-text">Try different keywords or browse all videos.</p>
@else
<h2 class="yt-empty-title">No videos yet</h2>
<p class="yt-empty-text">Be the first to upload a video!</p>
@endisset
@auth
<a href="/videos/create" class="yt-upload-btn" style="display: inline-flex;">
<i class="bi bi-plus-lg"></i>
Upload Video
</a>
</div>
@else
<div class="yt-video-grid">
@foreach($videos as $video)
<div class="yt-video-card">
<a href="{{ route('videos.show', $video->id) }}">
<div class="yt-video-thumb">
@if($video->thumbnail)
<img src="{{ asset('storage/thumbnails/' . $video->thumbnail) }}" alt="{{ $video->title }}">
@else
<img src="https://picsum.photos/seed/{{ $video->id }}/640/360" alt="{{ $video->title }}">
@endif
@if($video->duration)
<span class="yt-video-duration">{{ gmdate('i:s', $video->duration) }}</span>
@endif
</div>
</a>
<div class="yt-video-info">
<div class="yt-channel-icon"></div>
<div class="yt-video-details">
<h3 class="yt-video-title">
<a href="{{ route('videos.show', $video->id) }}">{{ $video->title }}</a>
</h3>
<div class="yt-channel-name">TAKEONE</div>
<div class="yt-video-meta">
{{ number_format($video->size / 1024 / 1024, 0) }} MB • {{ $video->created_at->diffForHumans() }}
</div>
</div>
<div class="position-relative">
<button class="yt-more-btn" data-bs-toggle="dropdown">
<i class="bi bi-three-dots-vertical"></i>
</button>
<ul class="dropdown-menu dropdown-menu-dark yt-more-dropdown dropdown-menu-end">
<li><a class="yt-more-dropdown-item" href="{{ route('videos.edit', $video->id) }}"><i class="bi bi-pencil"></i> Edit</a></li>
<li><a class="yt-more-dropdown-item" href="{{ route('videos.show', $video->id) }}"><i class="bi bi-play"></i> Play</a></li>
<li><hr class="dropdown-divider"></li>
<li>
<form action="{{ route('videos.destroy', $video->id) }}" method="POST" onsubmit="return confirm('Delete this video?');" class="m-0">
@csrf @method('DELETE')
<button type="submit" class="yt-more-dropdown-item text-danger"><i class="bi bi-trash"></i> Delete</button>
</form>
</li>
</ul>
@else
<a href="{{ route('login') }}" class="yt-upload-btn" style="display: inline-flex;">
<i class="bi bi-box-arrow-in-right"></i>
Login to Upload
</a>
@endauth
</div>
@else
<div class="yt-video-grid">
@foreach($videos as $video)
<div class="yt-video-card"
data-video-url="{{ asset('storage/videos/' . $video->filename) }}"
onmouseenter="playVideo(this)"
onmouseleave="stopVideo(this)">
<a href="{{ route('videos.show', $video->id) }}">
<div class="yt-video-thumb">
@if($video->thumbnail)
<img src="{{ asset('storage/thumbnails/' . $video->thumbnail) }}" alt="{{ $video->title }}">
@else
<img src="https://picsum.photos/seed/{{ $video->id }}/640/360" alt="{{ $video->title }}">
@endif
<video preload="none">
<source src="{{ asset('storage/videos/' . $video->filename) }}" type="{{ $video->mime_type ?? 'video/mp4' }}">
</video>
@if($video->duration)
<span class="yt-video-duration">{{ gmdate('i:s', $video->duration) }}</span>
@endif
</div>
</a>
<div class="yt-video-info">
<div class="yt-channel-icon">
@if($video->user && $video->user->avatar_url)
<img src="{{ $video->user->avatar_url }}" alt="{{ $video->user->name }}" style="width: 100%; height: 100%; object-fit: cover; border-radius: 50%;">
@endif
</div>
<div class="yt-video-details">
<h3 class="yt-video-title">
<a href="{{ route('videos.show', $video->id) }}">{{ $video->title }}</a>
</h3>
<div class="yt-channel-name">{{ $video->user->name ?? 'Unknown' }}</div>
<div class="yt-video-meta">
{{ number_format($video->size / 1024 / 1024, 0) }} MB • {{ $video->created_at->diffForHumans() }}
</div>
</div>
<div class="position-relative">
<button class="yt-more-btn" data-bs-toggle="dropdown">
<i class="bi bi-three-dots-vertical"></i>
</button>
<ul class="dropdown-menu dropdown-menu-dark yt-more-dropdown dropdown-menu-end">
@if($video->isShareable())
<li>
<button class="yt-more-dropdown-item" onclick="openShareModal('{{ $video->share_url }}', '{{ addslashes($video->title) }}')">
<i class="bi bi-share"></i> Share
</button>
</li>
@endif
<li><a class="yt-more-dropdown-item" href="{{ route('videos.edit', $video->id) }}"><i class="bi bi-pencil"></i> Edit</a></li>
<li><a class="yt-more-dropdown-item" href="{{ route('videos.show', $video->id) }}"><i class="bi bi-play"></i> Play</a></li>
<li><hr class="dropdown-divider"></li>
<li>
<form action="{{ route('videos.destroy', $video->id) }}" method="POST" onsubmit="return confirm('Delete this video?');" class="m-0">
@csrf @method('DELETE')
<button type="submit" class="yt-more-dropdown-item text-danger"><i class="bi bi-trash"></i> Delete</button>
</form>
</li>
</ul>
</div>
</div>
@endforeach
</div>
<div class="mt-4">{{ $videos->links() }}</div>
@endif
</main>
@endforeach
</div>
<div class="mt-4">{{ $videos->links() }}</div>
@endif
@include('layouts.partials.share-modal')
@include('layouts.partials.upload-modal')
@endsection
@section('scripts')
<script>
function playVideo(card) {
const video = card.querySelector('video');
if (video) {
video.currentTime = 0;
video.play().catch(function(e) {
// Auto-play may be blocked, ignore error
});
video.classList.add('active');
}
}
function stopVideo(card) {
const video = card.querySelector('video');
if (video) {
video.pause();
video.currentTime = 0;
video.classList.remove('active');
}
}
</script>
@endsection
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<script>
function toggleSidebar() {
const sidebar = document.getElementById('sidebar');
const overlay = document.querySelector('.yt-sidebar-overlay');
sidebar.classList.toggle('open');
overlay.classList.toggle('show');
}
</script>
</body>
</html>