-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathRemoveMember.php
55 lines (47 loc) · 1003 Bytes
/
RemoveMember.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
namespace App\Livewire\Company;
use App\Models\User;
use Illuminate\View\View;
use Livewire\Component;
class RemoveMember extends Component
{
public User $user;
public bool $isOpen = false;
/**
* Called when initializing the component
* @param $user
* @return void
*/
public function mount($user)
{
$this->user = $user;
}
/**
* Confirms the removal of the team member
* @return void
*/
public function confirm()
{
$this->user->syncRoles(['participant']);
$this->user->company_id = null;
$this->user->save();
$this->dispatch('user-removed');
$this->isOpen = false;
}
/**
* Closes the modal
* @return void
*/
public function close()
{
$this->isOpen = false;
}
/**
* Renders the component
* @return View
*/
public function render(): View
{
return view('livewire.company.remove-member');
}
}