/** * 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; }
public function testShouldInsertAndReturnSettings() { $this->userMailNotifyCriteria->shouldReceive('getByUserId')->times(2)->andReturn(null, 'mockData'); $this->userMailNotifyCriteria->shouldReceive('insert')->andReturn(null); $service = new MailNotifyService($this->userMailNotifyCriteria); $this->assertEquals('mockData', $service->getSettings(1235)); }
/** * 通知設定を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]; }