Exemple #1
0
 /**
  * Send a confirmation link to the given user.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function sendConfirmationLink(Request $request)
 {
     $this->validate($request, ['email' => 'required|email']);
     $response = Confirmation::sendConfirmationLink($request->only('email'), function (Message $message) {
         $message->subject($this->getEmailSubject());
     });
     switch ($response) {
         case Confirmation::CONFIRMATION_LINK_SENT:
             return redirect($this->loginPath())->with('status', trans($response));
         case Confirmation::INVALID_TOKEN:
             return redirect()->back()->withErrors(['email' => trans($response)]);
     }
 }
 /**
  * Send a confirmation link to the given user.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function postEmail(Request $request)
 {
     $this->validate($request, ['email' => 'required|email']);
     $response = Confirmation::sendConfirmationLink($request->only('email'), function (Message $message) {
         $message->subject($this->getEmailSubject());
     });
     switch ($response) {
         case Confirmation::CONFIRMATION_LINK_SENT:
             return responseJsonOk(['message' => trans($response)]);
         case Confirmation::ALREADY_VERIFIED:
             return responseJsonOk(['message' => trans($response)]);
         case Confirmation::INVALID_TOKEN:
             return responseJsonUnprocessableEntity(['message' => trans($response), 'errors' => ['email' => trans($response)]]);
     }
 }