create toggleWebNotifications method in user controller
This commit is contained in:
@@ -363,5 +363,18 @@ class UserController extends Controller
|
||||
return response()->json(['message' => "Server error"], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function togglWebNotifications(Request $request, int $id): JsonResponse {
|
||||
try {
|
||||
$user = User::findOrFail($id);
|
||||
$user->web_notifications = !$user->web_notifications ? 0 : 1;
|
||||
$user->save();
|
||||
|
||||
return response()->json($user);
|
||||
}catch(\Exception $e){
|
||||
Log::info($e->getMessage());
|
||||
return response()->json(['message' => "Server error"], 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user