diff --git a/app/Models/Video.php b/app/Models/Video.php index 0a432f8..b848373 100644 --- a/app/Models/Video.php +++ b/app/Models/Video.php @@ -18,6 +18,17 @@ class Video extends Model { use HasFactory, HasSnowflakePrimary; + /** + * Status Bitmask + * 0 = Unused + * 1 = Pending Transcoding + * 2 = Published + * 3 = Reserved + * 4 = Archived + * 5 = Reserved + * 6 = Admin unpublished + **/ + /** * Indicates if the IDs are auto-incrementing. * @@ -35,6 +46,7 @@ class Video extends Model protected function casts(): array { return [ + 'status' => 'integer', 'profile_id' => 'string', 'is_sensitive' => 'boolean', 'media_metadata' => 'array', @@ -53,6 +65,17 @@ class Video extends Model $query->where('comment_state', 4); } + public function statusLabel() + { + return match ($this->status) { + 1 => 'pending', + 2 => 'published', + 4 => 'archived', + 6 => 'unpublished', + default => null + }; + } + public function hashid() { return HashidService::encode($this->id);