| @@ 261-271 (lines=11) @@ | ||
| 258 | * @param \App\User $user |
|
| 259 | * @return \Illuminate\Http\JsonResponse |
|
| 260 | */ |
|
| 261 | public function ban(User $user) |
|
| 262 | { |
|
| 263 | $user->blocked = ! $user->blocked; |
|
| 264 | $user->save(); |
|
| 265 | ||
| 266 | if ($user->blocked) { |
|
| 267 | return $this->notifySuccess('User ' . $user->name . ' blocked!'); |
|
| 268 | } else { |
|
| 269 | return $this->notifySuccess('User ' . $user->name . ' un-blocked!'); |
|
| 270 | } |
|
| 271 | } |
|
| 272 | ||
| 273 | /** |
|
| 274 | * Toggle user activation status. |
|
| @@ 279-289 (lines=11) @@ | ||
| 276 | * @param \App\User $user |
|
| 277 | * @return \Illuminate\Http\JsonResponse |
|
| 278 | */ |
|
| 279 | public function activate(User $user) |
|
| 280 | { |
|
| 281 | $user->confirmed = ! $user->confirmed; |
|
| 282 | $user->save(); |
|
| 283 | ||
| 284 | if ($user->confirmed) { |
|
| 285 | return $this->notifySuccess('User ' . $user->name . ' activated!'); |
|
| 286 | } else { |
|
| 287 | return $this->notifySuccess('User ' . $user->name . ' deactivated!'); |
|
| 288 | } |
|
| 289 | } |
|
| 290 | } |
|
| 291 | ||