2023-06-02 12:34:45 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Livewire\Team;
|
|
|
|
|
|
|
|
use App\Models\User;
|
|
|
|
use Livewire\Component;
|
|
|
|
|
|
|
|
class Member extends Component
|
|
|
|
{
|
|
|
|
public User $member;
|
2023-06-09 15:55:21 +02:00
|
|
|
public function makeAdmin()
|
|
|
|
{
|
|
|
|
$this->member->teams()->updateExistingPivot(session('currentTeam')->id, ['role' => 'admin']);
|
|
|
|
$this->emit('reloadWindow');
|
|
|
|
}
|
|
|
|
public function makeReadonly()
|
|
|
|
{
|
2023-06-12 12:00:01 +02:00
|
|
|
$this->member->teams()->updateExistingPivot(session('currentTeam')->id, ['role' => 'member']);
|
2023-06-09 15:55:21 +02:00
|
|
|
$this->emit('reloadWindow');
|
|
|
|
}
|
2023-06-08 11:43:14 +02:00
|
|
|
public function remove()
|
2023-06-02 12:34:45 +02:00
|
|
|
{
|
2023-06-08 11:43:14 +02:00
|
|
|
$this->member->teams()->detach(session('currentTeam'));
|
|
|
|
$this->emit('reloadWindow');
|
2023-06-02 12:34:45 +02:00
|
|
|
}
|
|
|
|
}
|