From d9a30fbfc4ae0a96f410074e2c15f875059ddeea Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 30 Jun 2025 02:28:54 -0600 Subject: [PATCH] Update Video model --- app/Models/Video.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) 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);