public function store(RecommendationRequest $request, Article $article, ArticleMailer $mailer) { $mailer->recommendTo($request->input('email'), $article); session()->flash('flash_message', 'Your recommendation was sent'); if (Request::wantsJson()) { return ['Your recommendation was sent.']; } return redirect('articles'); }
/** * Show the form for creating a new resource. * * @return Response */ public function send(Article $article, ArticleMailer $mailer, ArticleEmailRequest $request) { $mailer->recommendTo($request->input('email'), 'Article recommendation', $article); return $this->respondTo(['html' => redirect('articles', 303), 'default' => 'Your article was sent.']); }