44 lines
1.1 KiB
PHP
44 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Livewire;
|
|
|
|
use App\Livewire\Concerns\ResolvesCustomer;
|
|
use LivewireUI\Modal\ModalComponent;
|
|
|
|
/**
|
|
* Confirmation before a seat's access ends (R23). Mirrors EditSeat: a modal
|
|
* is reachable without the page's route middleware, so the seat is resolved
|
|
* fresh from the signed-in customer rather than trusted from the caller.
|
|
*/
|
|
class ConfirmRevokeSeat extends ModalComponent
|
|
{
|
|
use ResolvesCustomer;
|
|
|
|
public string $uuid;
|
|
|
|
public string $name = '';
|
|
|
|
public function mount(string $uuid): void
|
|
{
|
|
$seat = $this->customer()?->seats()->where('uuid', $uuid)->first();
|
|
|
|
// Mirrors the button's own visibility: the row never offers "revoke"
|
|
// for the owner seat, so a stale or forged uuid gets 404 here too.
|
|
abort_if($seat === null || $seat->role === 'owner', 404);
|
|
|
|
$this->uuid = $uuid;
|
|
$this->name = (string) ($seat->name ?: $seat->email);
|
|
}
|
|
|
|
public function confirm(): void
|
|
{
|
|
$this->dispatch('seat-revoke-confirmed', uuid: $this->uuid);
|
|
$this->closeModal();
|
|
}
|
|
|
|
public function render()
|
|
{
|
|
return view('livewire.confirm-revoke-seat');
|
|
}
|
|
}
|