id(); $table->unsignedBigInteger('image_id')->nullable(); $table->unsignedBigInteger('category_id')->nullable(); $table->unsignedBigInteger('user_id')->nullable(); // owner (optional) $table->string('title'); $table->text('caption')->nullable(); // media type (audio / video) $table->enum('type', ['audio', 'video']); // File or URL $table->string('file_path')->nullable(); // stored file $table->string('external_url')->nullable(); // YouTube, etc. $table->integer('duration')->nullable(); // seconds // public/private $table->enum('visibility', ['public', 'private'])->default('public'); $table->timestamps(); $table->foreign('image_id')->references('id')->on('images')->nullOnDelete(); $table->foreign('category_id')->references('id')->on('categories')->nullOnDelete(); $table->foreign('user_id')->references('id')->on('users')->nullOnDelete(); }); } /** * Reverse the migrations. */ public function down(): void { Schema::dropIfExists('media'); } };