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