| @@ 95-106 (lines=12) @@ | ||
| 92 | return redirect()->action('Back\AdministratorsController@index'); |
|
| 93 | } |
|
| 94 | ||
| 95 | public function activate($id) |
|
| 96 | { |
|
| 97 | abort_unlees($user = $this->backUserRepository->find($id), 500); |
|
| 98 | ||
| 99 | $user->activate(); |
|
| 100 | ||
| 101 | $eventDescription = $this->getEventDescriptionFor('activated', $user); |
|
| 102 | activity($eventDescription); |
|
| 103 | flash()->success(strip_tags($eventDescription)); |
|
| 104 | ||
| 105 | return back(); |
|
| 106 | } |
|
| 107 | ||
| 108 | public function destroy($id) |
|
| 109 | { |
|
| @@ 108-120 (lines=13) @@ | ||
| 105 | return back(); |
|
| 106 | } |
|
| 107 | ||
| 108 | public function destroy($id) |
|
| 109 | { |
|
| 110 | $user = $this->backUserRepository->find($id); |
|
| 111 | ||
| 112 | $eventDescription = $this->getEventDescriptionFor('deleted', $user); |
|
| 113 | ||
| 114 | $this->backUserRepository->delete($user); |
|
| 115 | ||
| 116 | activity($eventDescription); |
|
| 117 | flash()->success(strip_tags($eventDescription)); |
|
| 118 | ||
| 119 | return redirect()->action('Back\AdministratorsController@index'); |
|
| 120 | } |
|
| 121 | ||
| 122 | protected function getEventDescriptionFor(string $event, User $user): string |
|
| 123 | { |
|
| @@ 87-98 (lines=12) @@ | ||
| 84 | return redirect()->action('Back\MembersController@index'); |
|
| 85 | } |
|
| 86 | ||
| 87 | public function destroy($id) |
|
| 88 | { |
|
| 89 | $user = $this->frontUserRepository->find($id); |
|
| 90 | ||
| 91 | $this->frontUserRepository->delete($user); |
|
| 92 | ||
| 93 | $eventDescription = $this->getEventDescriptionFor('deleted', $user); |
|
| 94 | activity()->log($eventDescription); |
|
| 95 | flash()->success(strip_tags($eventDescription)); |
|
| 96 | ||
| 97 | return redirect()->action('Back\MembersController@index'); |
|
| 98 | } |
|
| 99 | ||
| 100 | protected function getEventDescriptionFor(string $event, User $user): string |
|
| 101 | { |
|