<?php

namespace App\Livewire\Pages\Team;

use App\Domains\Workspace\Models\Workspace;
use App\Domains\Workspace\Models\WorkspaceMember;
use Illuminate\View\View;
use Livewire\Component;

class Members extends Component
{
    public int $workspaceId = 0;

    public function mount(): void
    {
        $this->workspaceId = require_workspace()->id;
    }

    public function render(): View
    {
        $members = WorkspaceMember::with('user')
            ->where('workspace_id', $this->workspaceId)
            ->get();

        return view('livewire.pages.team.members', compact('members'))
            ->layout('layouts.nimuli-app', ['title' => 'Team']);
    }
}
