takeone-youtube-clone/app/Models/VideoAudioTrack.php
ghassan 66fd78c10f Add multi-language audio tracks and self-hosted flag-icons
Introduce per-video language support and multiple audio tracks
(VideoAudioTrack model + migrations for language, description, title),
a reusable language-select component, and a track-editor form. Bundle
the self-hosted flag-icons v7.2.3 library and a NAS auto-sync command.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 21:32:52 +03:00

28 lines
714 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class VideoAudioTrack extends Model
{
protected $fillable = ['video_id', 'language', 'label', 'title', 'description', 'path', 'filename'];
public function video(): BelongsTo
{
return $this->belongsTo(Video::class);
}
public function getStreamUrlAttribute(): string
{
return route('videos.audio-track', ['video' => $this->video_id, 'track' => $this->id]);
}
/** Absolute local path to the file, regardless of NAS or local storage. */
public function localPath(): string
{
return storage_path('app/' . $this->path);
}
}