/** * Configに合わせてメール通知HTMLコンポーネントを返す * * @return View | null */ protected function renderHtml() { if ($this->notifyEnable) { $notifyFlags = $this->mailNotifyService->getSettings($this->userService->getCurrentUser()->id); return view('user.edit._mail-notify', compact('notifyFlags'))->render(); } return null; }
/** * 通知設定をONにしてるかどうかチェックする * * @param string $type * @param int $userId * * @return bool */ protected function notificationIsEnabled($type, $userId) { $colomnName = $type . '_notification_flag'; $flags = (array) $this->mailNotifyService->getSettings($userId); return !!$flags[$colomnName]; }
public function testShouldReturnUpdateResult() { $this->userMailNotifyCriteria->shouldReceive('update')->andReturn(true); $service = new MailNotifyService($this->userMailNotifyCriteria); $this->assertTrue($service->updateSetting(1235, 'comment', 0)); }
/** * 設定を更新 * * @param Request $request * @param UserService $userService * @param MailNotifyService $mailNotifyService * * @return \Illuminate\Http\Response */ public function update(Request $request, UserService $userService, MailNotifyService $mailNotifyService) { $params = $request->only(['type', 'flag']); $result = $mailNotifyService->updateSetting($userService->getCurrentUser()->id, $params['type'], $params['flag']); return response()->json(['result' => $result]); }