admin panel added and comments are working and likes are working

This commit is contained in:
ghassan committed 2026-03-03 17:36:19 +03:00
1 parent 72e9439727
commit a28023c29b
32 files changed
+5077 -2999

No files matched your search

@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
$table->enum('role', ['user', 'admin', 'super_admin'])->default('user')->after('email');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('role');
});
}
};
@@ -0,0 +1,25 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('comments', function (Blueprint $table) {
$table->id();
$table->foreignId('video_id')->constrained()->onDelete('cascade');
$table->foreignId('user_id')->constrained()->onDelete('cascade');
$table->foreignId('parent_id')->nullable()->constrained('comments')->onDelete('cascade');
$table->text('body');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('comments');
}
};
+117 -9
View File
@@ -2,21 +2,129 @@
namespace Database\Seeders;
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*/
public function run(): void
{
// \App\Models\User::factory(10)->create();
// Create sample users
$user1Id = DB::table('users')->insertGetId([
'name' => 'Music Channel',
'email' => '[email protected]',
'password' => Hash::make('password'),
'avatar' => null,
'role' => 'user',
'created_at' => now(),
'updated_at' => now(),
]);
// \App\Models\User::factory()->create([
// 'name' => 'Test User',
// 'email' => 'test@example.com',
// ]);
$user2Id = DB::table('users')->insertGetId([
'name' => 'Sports Channel',
'email' => 'sports@example.com',
'password' => Hash::make('password'),
'avatar' => null,
'role' => 'user',
'created_at' => now(),
'updated_at' => now(),
]);
$user3Id = DB::table('users')->insertGetId([
'name' => 'Entertainment',
'email' => '[email protected]',
'password' => Hash::make('password'),
'avatar' => null,
'role' => 'user',
'created_at' => now(),
'updated_at' => now(),
]);
// Create sample videos
// Video 1 - Music type
DB::table('videos')->insert([
'user_id' => $user1Id,
'title' => 'Summer Vibes - Official Music Video',
'description' => "Check out our latest summer hit! 🎵\n\n#SummerVibes #Music #2024",
'filename' => 'sample-video-1.mp4',
'path' => 'public/videos/sample-video-1.mp4',
'thumbnail' => null,
'duration' => 240,
'size' => 15000000,
'mime_type' => 'video/mp4',
'orientation' => 'landscape',
'width' => 1920,
'height' => 1080,
'status' => 'ready',
'visibility' => 'public',
'type' => 'music',
'created_at' => now(),
'updated_at' => now(),
]);
// Video 2 - Match type
DB::table('videos')->insert([
'user_id' => $user2Id,
'title' => 'Championship Finals - Full Match Highlights',
'description' => "Watch the exciting championship finals! 🏆\n\n#Championship #Sports #Highlights",
'filename' => 'sample-video-2.mp4',
'path' => 'public/videos/sample-video-2.mp4',
'thumbnail' => null,
'duration' => 600,
'size' => 35000000,
'mime_type' => 'video/mp4',
'orientation' => 'landscape',
'width' => 1920,
'height' => 1080,
'status' => 'ready',
'visibility' => 'public',
'type' => 'match',
'created_at' => now(),
'updated_at' => now(),
]);
// Video 3 - Generic type
DB::table('videos')->insert([
'user_id' => $user3Id,
'title' => 'Behind the Scenes - Movie Production',
'description' => "Go behind the scenes of our latest movie production! 🎬\n\n#BehindTheScenes #Movie #Production",
'filename' => 'sample-video-3.mp4',
'path' => 'public/videos/sample-video-3.mp4',
'thumbnail' => null,
'duration' => 180,
'size' => 12000000,
'mime_type' => 'video/mp4',
'orientation' => 'landscape',
'width' => 1920,
'height' => 1080,
'status' => 'ready',
'visibility' => 'public',
'type' => 'generic',
'created_at' => now(),
'updated_at' => now(),
]);
// Video 4 - Music type
DB::table('videos')->insert([
'user_id' => $user1Id,
'title' => 'Acoustic Sessions - Live Performance',
'description' => "Our live acoustic performance at the studio 🎵\n\n#Acoustic #LiveMusic #Sessions",
'filename' => 'sample-video-4.mp4',
'path' => 'public/videos/sample-video-4.mp4',
'thumbnail' => null,
'duration' => 300,
'size' => 20000000,
'mime_type' => 'video/mp4',
'orientation' => 'landscape',
'width' => 1920,
'height' => 1080,
'status' => 'ready',
'visibility' => 'public',
'type' => 'music',
'created_at' => now(),
'updated_at' => now(),
]);
}
}