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:
1 parent
6a2026df4b
commit
5253f89b63
35 files changed
+5092
-849
No files matched your search
@@ -1,109 +1,380 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Upload Video - TAKEONE</title>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
<style>
|
||||
body { background-color: #0f0f0f; color: #fff; }
|
||||
</style>
|
||||
</head>
|
||||
<body class="min-h-screen">
|
||||
<header class="bg-[#0f0f0f] border-b border-gray-800">
|
||||
<div class="max-w-7xl mx-auto px-4 py-3">
|
||||
<a href="/videos" class="text-2xl font-bold text-red-600">TAKEONE</a>
|
||||
</div>
|
||||
</header>
|
||||
@extends('layouts.app')
|
||||
|
||||
<main class="max-w-3xl mx-auto px-4 py-8">
|
||||
<h1 class="text-3xl font-bold mb-8">Upload Video</h1>
|
||||
@section('title', 'Upload Video | TAKEONE')
|
||||
|
||||
@section('extra_styles')
|
||||
<style>
|
||||
.upload-container {
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
<form id="upload-form" enctype="multipart/form-data" class="space-y-6">
|
||||
.form-group {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.form-label {
|
||||
display: block;
|
||||
margin-bottom: 8px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.form-input, .form-select, .form-textarea {
|
||||
width: 100%;
|
||||
background: #121212;
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 8px;
|
||||
padding: 12px 16px;
|
||||
color: var(--text-primary);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.form-input:focus, .form-select:focus, .form-textarea:focus {
|
||||
outline: none;
|
||||
border-color: var(--brand-red);
|
||||
}
|
||||
|
||||
.form-textarea {
|
||||
resize: vertical;
|
||||
min-height: 100px;
|
||||
}
|
||||
|
||||
/* Dropzone */
|
||||
#dropzone, #thumbnail-dropzone {
|
||||
border: 2px dashed var(--border-color);
|
||||
border-radius: 12px;
|
||||
padding: 40px 20px;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
/* Hide file input */
|
||||
#video, #thumbnail {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#dropzone:hover, #dropzone.dragover,
|
||||
#thumbnail-dropzone:hover, #thumbnail-dropzone.dragover {
|
||||
border-color: var(--brand-red);
|
||||
background: rgba(230, 30, 30, 0.05);
|
||||
}
|
||||
|
||||
#dropzone .icon, #thumbnail-dropzone .icon {
|
||||
font-size: 48px;
|
||||
color: var(--text-secondary);
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
#dropzone p, #thumbnail-dropzone p {
|
||||
color: var(--text-secondary);
|
||||
margin: 8px 0;
|
||||
}
|
||||
|
||||
#dropzone .hint, #thumbnail-dropzone .hint {
|
||||
font-size: 12px;
|
||||
color: var(--text-secondary);
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
#file-info, #thumbnail-info {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#file-info.active, #thumbnail-info.active {
|
||||
display: block;
|
||||
}
|
||||
|
||||
#file-info .filename, #thumbnail-info .filename {
|
||||
color: var(--brand-red);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* Upload Row - Side by Side */
|
||||
.upload-row {
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.upload-row .form-group {
|
||||
flex: 1;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
/* Progress Bar */
|
||||
#progress-container {
|
||||
display: none;
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
#progress-container.active {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.progress-bar-wrapper {
|
||||
background: var(--border-color);
|
||||
border-radius: 4px;
|
||||
height: 8px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.progress-bar-fill {
|
||||
background: var(--brand-red);
|
||||
height: 100%;
|
||||
width: 0%;
|
||||
transition: width 0.3s;
|
||||
}
|
||||
|
||||
.progress-text {
|
||||
text-align: center;
|
||||
color: var(--text-secondary);
|
||||
font-size: 14px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
/* Status Message */
|
||||
#status-message {
|
||||
display: none;
|
||||
padding: 16px;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
#status-message.success {
|
||||
display: block;
|
||||
background: rgba(34, 197, 94, 0.2);
|
||||
color: #22c55e;
|
||||
border: 1px solid #22c55e;
|
||||
}
|
||||
|
||||
#status-message.error {
|
||||
display: block;
|
||||
background: rgba(239, 68, 68, 0.2);
|
||||
color: #ef4444;
|
||||
border: 1px solid #ef4444;
|
||||
}
|
||||
|
||||
/* Submit Button */
|
||||
.btn-submit {
|
||||
width: 100%;
|
||||
background: var(--brand-red);
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 14px 24px;
|
||||
border-radius: 8px;
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: background 0.2s;
|
||||
}
|
||||
|
||||
.btn-submit:hover {
|
||||
background: #cc1a1a;
|
||||
}
|
||||
|
||||
.btn-submit:disabled {
|
||||
background: #555;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
/* Upload Page Layout */
|
||||
.upload-page .yt-main {
|
||||
display: block;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
/* Visibility Options */
|
||||
.visibility-options {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.visibility-option {
|
||||
display: block;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.visibility-option input {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.visibility-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
padding: 16px;
|
||||
background: #1a1a1a;
|
||||
border: 2px solid var(--border-color);
|
||||
border-radius: 12px;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.visibility-option:hover .visibility-content {
|
||||
border-color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.visibility-option.active .visibility-content {
|
||||
border-color: var(--brand-red);
|
||||
background: rgba(230, 30, 30, 0.1);
|
||||
}
|
||||
|
||||
.visibility-content i {
|
||||
font-size: 24px;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.visibility-option.active .visibility-content i {
|
||||
color: var(--brand-red);
|
||||
}
|
||||
|
||||
.visibility-title {
|
||||
font-weight: 500;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.visibility-desc {
|
||||
color: var(--text-secondary);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
@media (min-width: 992px) {
|
||||
.upload-page .yt-main {
|
||||
margin-left: 240px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<div class="upload-container">
|
||||
<h1 style="font-size: 24px; font-weight: 500; margin-bottom: 24px;">Upload Video</h1>
|
||||
|
||||
<form id="upload-form" enctype="multipart/form-data">
|
||||
@csrf
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium mb-2">Title *</label>
|
||||
<div class="form-group">
|
||||
<label class="form-label">Title *</label>
|
||||
<input type="text" name="title" required
|
||||
class="w-full bg-[#272727] border border-gray-700 rounded-lg px-4 py-3 focus:outline-none focus:border-red-600"
|
||||
class="form-input"
|
||||
placeholder="Enter video title">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium mb-2">Description</label>
|
||||
<div class="form-group">
|
||||
<label class="form-label">Description</label>
|
||||
<textarea name="description" rows="4"
|
||||
class="w-full bg-[#272727] border border-gray-700 rounded-lg px-4 py-3 focus:outline-none focus:border-red-600"
|
||||
class="form-textarea"
|
||||
placeholder="Tell viewers about your video"></textarea>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium mb-2">Video File *</label>
|
||||
<div id="dropzone" class="border-2 border-dashed border-gray-700 rounded-lg p-8 text-center cursor-pointer hover:border-red-500 transition-colors">
|
||||
<input type="file" name="video" id="video" accept="video/*" required class="hidden" onchange="handleFileSelect(this)">
|
||||
<div id="dropzone-content">
|
||||
<svg class="h-12 w-12 mx-auto text-gray-500 mb-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12" />
|
||||
</svg>
|
||||
<p class="text-gray-400 mb-2">Click to select or drag video here</p>
|
||||
<p class="text-gray-500 text-sm">MP4, MOV, AVI, WebM up to 500MB</p>
|
||||
<div class="upload-row">
|
||||
<div class="form-group">
|
||||
<label class="form-label">Video File *</label>
|
||||
<div id="dropzone">
|
||||
<input type="file" name="video" id="video" accept="video/*" required>
|
||||
<div id="dropzone-default">
|
||||
<i class="bi bi-camera-video icon"></i>
|
||||
<p>Click to select or drag video here</p>
|
||||
<p class="hint">MP4, MOV, AVI, WebM up to 2GB</p>
|
||||
</div>
|
||||
<div id="file-info">
|
||||
<p class="filename" id="filename"></p>
|
||||
<p id="filesize"></p>
|
||||
</div>
|
||||
</div>
|
||||
<div id="file-info" class="hidden">
|
||||
<p id="filename" class="text-green-500 font-medium"></p>
|
||||
<p id="filesize" class="text-gray-400 text-sm"></p>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="form-label">Thumbnail (optional)</label>
|
||||
<div id="thumbnail-dropzone">
|
||||
<input type="file" name="thumbnail" id="thumbnail" accept="image/*">
|
||||
<div id="thumbnail-default">
|
||||
<i class="bi bi-image icon"></i>
|
||||
<p>Click to select or drag thumbnail</p>
|
||||
<p class="hint">JPG, PNG, WebP up to 5MB</p>
|
||||
</div>
|
||||
<div id="thumbnail-info">
|
||||
<p class="filename" id="thumbnail-filename"></p>
|
||||
<p id="thumbnail-filesize"></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium mb-2">Orientation</label>
|
||||
<select name="orientation" class="w-full bg-[#272727] border border-gray-700 rounded-lg px-4 py-3 focus:outline-none focus:border-red-600">
|
||||
<option value="landscape">Landscape (16:9)</option>
|
||||
<option value="portrait">Portrait (9:16)</option>
|
||||
<option value="square">Square (1:1)</option>
|
||||
<option value="ultrawide">Ultrawide (21:9)</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium mb-2">Thumbnail (optional)</label>
|
||||
<input type="file" name="thumbnail" accept="image/*" class="w-full bg-[#272727] border border-gray-700 rounded-lg px-4 py-3 focus:outline-none focus:border-red-600">
|
||||
<div class="form-group">
|
||||
<label class="form-label">Privacy</label>
|
||||
<div class="visibility-options">
|
||||
<label class="visibility-option active">
|
||||
<input type="radio" name="visibility" value="public" checked>
|
||||
<div class="visibility-content">
|
||||
<i class="bi bi-globe"></i>
|
||||
<span class="visibility-title">Public</span>
|
||||
<span class="visibility-desc">Everyone can see this video</span>
|
||||
</div>
|
||||
</label>
|
||||
<label class="visibility-option">
|
||||
<input type="radio" name="visibility" value="unlisted">
|
||||
<div class="visibility-content">
|
||||
<i class="bi bi-link-45deg"></i>
|
||||
<span class="visibility-title">Unlisted</span>
|
||||
<span class="visibility-desc">Only people with the link can see</span>
|
||||
</div>
|
||||
</label>
|
||||
<label class="visibility-option">
|
||||
<input type="radio" name="visibility" value="private">
|
||||
<div class="visibility-content">
|
||||
<i class="bi bi-lock"></i>
|
||||
<span class="visibility-title">Private</span>
|
||||
<span class="visibility-desc">Only you can see this video</span>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Progress Bar -->
|
||||
<div id="progress-container" class="hidden">
|
||||
<div class="bg-gray-700 rounded-full h-4 overflow-hidden">
|
||||
<div id="progress-bar" class="bg-red-600 h-full transition-all duration-300" style="width: 0%"></div>
|
||||
<div id="progress-container">
|
||||
<div class="progress-bar-wrapper">
|
||||
<div id="progress-bar" class="progress-bar-fill"></div>
|
||||
</div>
|
||||
<p id="progress-text" class="text-center text-gray-400 text-sm mt-2">Uploading... 0%</p>
|
||||
<p id="progress-text" class="progress-text">Uploading... 0%</p>
|
||||
</div>
|
||||
|
||||
<!-- Status Message -->
|
||||
<div id="status-message" class="hidden p-4 rounded-lg"></div>
|
||||
<div id="status-message"></div>
|
||||
|
||||
<button type="submit" id="submit-btn" class="w-full bg-red-600 hover:bg-red-700 text-white font-semibold py-3 rounded-lg transition-colors">
|
||||
<button type="submit" id="submit-btn" class="btn-submit">
|
||||
Upload Video
|
||||
</button>
|
||||
</form>
|
||||
</main>
|
||||
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('scripts')
|
||||
<script>
|
||||
// Video Dropzone
|
||||
const dropzone = document.getElementById('dropzone');
|
||||
const fileInput = document.getElementById('video');
|
||||
|
||||
// Add change event listener for video file selection
|
||||
fileInput.addEventListener('change', function() {
|
||||
handleFileSelect(this);
|
||||
});
|
||||
|
||||
dropzone.addEventListener('click', () => fileInput.click());
|
||||
|
||||
dropzone.addEventListener('dragover', (e) => {
|
||||
e.preventDefault();
|
||||
dropzone.classList.add('border-red-500');
|
||||
dropzone.classList.add('dragover');
|
||||
});
|
||||
|
||||
dropzone.addEventListener('dragleave', () => {
|
||||
dropzone.classList.remove('border-red-500');
|
||||
dropzone.classList.remove('dragover');
|
||||
});
|
||||
|
||||
dropzone.addEventListener('drop', (e) => {
|
||||
e.preventDefault();
|
||||
dropzone.classList.remove('border-red-500');
|
||||
dropzone.classList.remove('dragover');
|
||||
if (e.dataTransfer.files.length) {
|
||||
fileInput.files = e.dataTransfer.files;
|
||||
handleFileSelect(fileInput);
|
||||
@@ -115,20 +386,69 @@
|
||||
const file = input.files[0];
|
||||
document.getElementById('filename').textContent = file.name;
|
||||
document.getElementById('filesize').textContent = (file.size / 1024 / 1024).toFixed(2) + ' MB';
|
||||
document.getElementById('dropzone-content').classList.add('hidden');
|
||||
document.getElementById('file-info').classList.remove('hidden');
|
||||
document.getElementById('dropzone-default').style.display = 'none';
|
||||
document.getElementById('file-info').classList.add('active');
|
||||
}
|
||||
}
|
||||
|
||||
// Thumbnail Dropzone
|
||||
const thumbnailDropzone = document.getElementById('thumbnail-dropzone');
|
||||
const thumbnailInput = document.getElementById('thumbnail');
|
||||
|
||||
thumbnailDropzone.addEventListener('click', () => thumbnailInput.click());
|
||||
|
||||
thumbnailDropzone.addEventListener('dragover', (e) => {
|
||||
e.preventDefault();
|
||||
thumbnailDropzone.classList.add('dragover');
|
||||
});
|
||||
|
||||
thumbnailDropzone.addEventListener('dragleave', () => {
|
||||
thumbnailDropzone.classList.remove('dragover');
|
||||
});
|
||||
|
||||
thumbnailDropzone.addEventListener('drop', (e) => {
|
||||
e.preventDefault();
|
||||
thumbnailDropzone.classList.remove('dragover');
|
||||
if (e.dataTransfer.files.length) {
|
||||
thumbnailInput.files = e.dataTransfer.files;
|
||||
handleThumbnailSelect(thumbnailInput);
|
||||
}
|
||||
});
|
||||
|
||||
thumbnailInput.addEventListener('change', function() {
|
||||
handleThumbnailSelect(this);
|
||||
});
|
||||
|
||||
function handleThumbnailSelect(input) {
|
||||
if (input.files && input.files[0]) {
|
||||
const file = input.files[0];
|
||||
document.getElementById('thumbnail-filename').textContent = file.name;
|
||||
document.getElementById('thumbnail-filesize').textContent = (file.size / 1024 / 1024).toFixed(2) + ' MB';
|
||||
document.getElementById('thumbnail-default').style.display = 'none';
|
||||
document.getElementById('thumbnail-info').classList.add('active');
|
||||
}
|
||||
}
|
||||
|
||||
// Visibility option handling
|
||||
const visibilityOptions = document.querySelectorAll('.visibility-option');
|
||||
visibilityOptions.forEach(option => {
|
||||
const radio = option.querySelector('input[type="radio"]');
|
||||
radio.addEventListener('change', function() {
|
||||
visibilityOptions.forEach(opt => opt.classList.remove('active'));
|
||||
option.classList.add('active');
|
||||
});
|
||||
});
|
||||
|
||||
document.getElementById('upload-form').addEventListener('submit', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
const formData = new FormData(this);
|
||||
const xhr = new XMLHttpRequest();
|
||||
|
||||
document.getElementById('progress-container').classList.remove('hidden');
|
||||
document.getElementById('progress-container').classList.add('active');
|
||||
document.getElementById('submit-btn').disabled = true;
|
||||
document.getElementById('submit-btn').textContent = 'Uploading...';
|
||||
document.getElementById('status-message').className = '';
|
||||
|
||||
xhr.upload.addEventListener('progress', function(e) {
|
||||
if (e.lengthComputable) {
|
||||
@@ -166,12 +486,11 @@
|
||||
|
||||
function showError(message) {
|
||||
const status = document.getElementById('status-message');
|
||||
status.className = 'p-4 rounded-lg bg-red-600 text-white';
|
||||
status.textContent = message;
|
||||
status.classList.remove('hidden');
|
||||
status.className = 'error';
|
||||
document.getElementById('submit-btn').disabled = false;
|
||||
document.getElementById('submit-btn').textContent = 'Upload Video';
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@endsection
|
||||
|
||||
Reference in new issue
Block a user