/** * Show main result page. * * @param ResultsRepository $resultsRepository * * @return \Illuminate\View\View */ public function index(ResultsRepository $resultsRepository) { $participants = $resultsRepository->participants(); $centres_participants = $resultsRepository->centres_participants(); $centres_non_participants = $resultsRepository->centres_non_participants(); $results = $resultsRepository; return view('results.index', compact('participants', 'centres_participants', 'centres_non_participants', 'results')); }
/** * Notify members that SurveyFinalResults. * * @param $title * @param $body * * @return mixed */ public function notify($title = null, $body = null) { $config = App::make(Config::class); $emailParams = $config->get('These.admin.email'); $options = ['list_id' => Self::PARTIAL_RESULTS_LIST, 'subject' => 'Résultats ALR', 'from_name' => $emailParams['name'], 'from_email' => $emailParams['from'], 'to_name' => 'Résultats temporaires']; $participants = $this->results->participants(); $centres_participants = $this->results->centres_participants(); $centres_non_participants = $this->results->centres_non_participants(); $results = $this->results; $body = view('emails.partial-results', compact('participants', 'centres_participants', 'centres_non_participants', 'results'))->__toString(); $content = ['html' => $body, 'text' => strip_tags($body)]; // Create a new campaign $campaign = $this->mailchimp->campaigns->create('regular', $options, $content); return $this->mailchimp->campaigns->send($campaign['id']); }