'array', 'expires_at' => 'datetime', ]; public static function findOrCreateForAdmin(?string $threadId, int $adminId): static { if ($threadId) { $thread = static::where('thread_id', $threadId) ->where('admin_id', $adminId) ->first(); if ($thread) { return $thread; } } return static::create([ 'thread_id' => (string) Str::uuid(), 'admin_id' => $adminId, 'messages' => [], 'expires_at' => now()->addDays(30), ]); } }