2023-06-12 10:00:01 +00:00
|
|
|
<?php
|
|
|
|
|
2023-12-07 18:06:32 +00:00
|
|
|
namespace App\Livewire\Team;
|
2023-06-12 10:00:01 +00:00
|
|
|
|
|
|
|
use App\Models\TeamInvitation;
|
|
|
|
use Livewire\Component;
|
|
|
|
|
|
|
|
class Invitations extends Component
|
|
|
|
{
|
|
|
|
public $invitations;
|
|
|
|
protected $listeners = ['refreshInvitations'];
|
2023-08-08 09:51:36 +00:00
|
|
|
|
2023-06-12 10:00:01 +00:00
|
|
|
public function deleteInvitation(int $invitation_id)
|
|
|
|
{
|
|
|
|
TeamInvitation::find($invitation_id)->delete();
|
|
|
|
$this->refreshInvitations();
|
2023-12-07 18:06:32 +00:00
|
|
|
$this->dispatch('success', 'Invitation revoked.');
|
2023-06-12 10:00:01 +00:00
|
|
|
}
|
2023-08-08 09:51:36 +00:00
|
|
|
|
|
|
|
public function refreshInvitations()
|
|
|
|
{
|
2023-08-22 15:44:49 +00:00
|
|
|
$this->invitations = TeamInvitation::whereTeamId(currentTeam()->id)->get();
|
2023-08-08 09:51:36 +00:00
|
|
|
}
|
2023-06-12 10:00:01 +00:00
|
|
|
}
|