|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Pratiksh\Adminetic\Http\Livewire\Admin\Role; |
|
4
|
|
|
|
|
5
|
|
|
use Livewire\Component; |
|
6
|
|
|
use Pratiksh\Adminetic\Models\Admin\Permission; |
|
7
|
|
|
|
|
8
|
|
|
class Bread extends Component |
|
9
|
|
|
{ |
|
10
|
|
|
public $permission; |
|
11
|
|
|
public $browse = true; |
|
12
|
|
|
public $read = true; |
|
13
|
|
|
public $edit = true; |
|
14
|
|
|
public $add = true; |
|
15
|
|
|
public $delete = true; |
|
16
|
|
|
|
|
17
|
|
|
public function mount(Permission $permission) |
|
18
|
|
|
{ |
|
19
|
|
|
$this->permission = $permission; |
|
20
|
|
|
$this->browse = $permission->browse; |
|
21
|
|
|
$this->read = $permission->read; |
|
22
|
|
|
$this->edit = $permission->edit; |
|
23
|
|
|
$this->add = $permission->add; |
|
24
|
|
|
$this->delete = $permission->delete; |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
public function updatedBrowse() |
|
28
|
|
|
{ |
|
29
|
|
|
$this->permission->update([ |
|
30
|
|
|
'browse' => $this->browse, |
|
31
|
|
|
]); |
|
32
|
|
|
$this->emit('bread_updated', $this->permission->model.' model browse flag updated'); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
public function updatedRead() |
|
36
|
|
|
{ |
|
37
|
|
|
$this->permission->update([ |
|
38
|
|
|
'read' => $this->read, |
|
39
|
|
|
]); |
|
40
|
|
|
$this->emit('bread_updated', $this->permission->model.' model read flag updated'); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
public function updatedEdit() |
|
44
|
|
|
{ |
|
45
|
|
|
$this->permission->update([ |
|
46
|
|
|
'edit' => $this->edit, |
|
47
|
|
|
]); |
|
48
|
|
|
$this->emit('bread_updated', $this->permission->model.' model edit flag updated'); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
public function updatedAdd() |
|
52
|
|
|
{ |
|
53
|
|
|
$this->permission->update([ |
|
54
|
|
|
'add' => $this->add, |
|
55
|
|
|
]); |
|
56
|
|
|
$this->emit('bread_updated', $this->permission->model.' model add flag updated'); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
public function updatedDelete() |
|
60
|
|
|
{ |
|
61
|
|
|
$this->permission->update([ |
|
62
|
|
|
'delete' => $this->delete, |
|
63
|
|
|
]); |
|
64
|
|
|
$this->emit('bread_updated', $this->permission->model.' model delete flag updated'); |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
public function delete() |
|
68
|
|
|
{ |
|
69
|
|
|
$this->permission->delete(); |
|
70
|
|
|
$this->permission = null; |
|
71
|
|
|
$this->emit('permission_deleted'); |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
public function render() |
|
75
|
|
|
{ |
|
76
|
|
|
return view('adminetic::livewire.admin.role.bread'); |
|
77
|
|
|
} |
|
78
|
|
|
} |
|
79
|
|
|
|