lasthourcloud/app/Http/Livewire/Team/Member.php

30 lines
663 B
PHP
Raw Normal View History

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