<?php

namespace App\Filament\Tenant\Resources\TaskCollectionResource\Pages;

use App\Filament\Tenant\Resources\TaskCollectionResource;
use Filament\Resources\Pages\EditRecord;
use Illuminate\Support\Facades\Auth;

class EditTaskCollection extends EditRecord
{
    protected static string $resource = TaskCollectionResource::class;

    protected function authorizeAccess(): void
    {
        parent::authorizeAccess();

        $record = $this->getRecord();

        if ($record->tenant_id !== Auth::user()?->tenant_id) {
            abort(403);
        }
    }
}
