コード例 #1
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(MailRequest $request, $id)
 {
     $new_mail = new mail();
     $users = new User();
     $users = $users->showUsersName();
     if ($new_mail->editSpecificMail($request->all(), $id)) {
         return redirect('/Output')->with(['status' => 'Congratulations your maill has been updated!', 'users' => $users]);
     }
 }
コード例 #2
0
 public function index(MailRequest $request)
 {
     $contactName = $request->input('name');
     $contactEmail = $request->input('email');
     $contactNumber = $request->input('contact_number');
     $contactMessage = $request->input('message');
     $data = ['name' => $contactName, 'email' => $contactEmail, 'number' => $contactNumber, 'bodyMessage' => $contactMessage];
     mail::send('articles.enquiry', $data, function ($message) {
         $message->to('*****@*****.**', 'Adam Johnson')->subject('Website Enquiry');
         $message->from('*****@*****.**', 'AJDigital');
     });
     return redirect('/')->with(['flash_message' => 'Your message has been sent', 'flash_message_important' => false]);
 }
コード例 #3
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(MailRequest $request)
 {
     $data = array('website' => "Laravel Learning 5.1", 'subject' => $request->input('subject'), 'recipient' => $request->input('recipient'), 'from' => $request->input('from'), 'sendtext' => $request->input('message'));
     $send = Mail::send('mail.welcome', $data, function ($message) use($request) {
         $message->from('*****@*****.**', 'Learning Laravel');
         $message->to($request->input('recipient'))->subject($request->input('subject'));
     });
     if ($send) {
         return redirect('mail')->with('message', 'Your email has been sent successfully.');
     } else {
         return back()->withInput()->withErrors();
     }
 }
コード例 #4
0
 /**
  * Store a newly created resource in storage.
  *
  * @param $username
  * @param MailRequest $request
  * @return Response
  */
 public function store($username, MailRequest $request)
 {
     $receiver = $this->user->findOrFailByUsername($username);
     $m = $request->user()->messages()->create(['message' => $request->message, 'reciever_id' => $receiver->id]);
     if ($m) {
         // Create notification and dispatch it
         $receiver->newNotification()->from($request->user())->withType('UserMessageSent')->withSubject('New message!')->withBody(link_to_route('user.show', $request->user()->displayName(), $request->user()->username) . " has sent you " . link_to_route('messages.show', "new message", $request->user()->username))->regarding($m)->deliver();
         // Sends email to reciever if activated notifications
         if ($receiver->email_notifications_new_message == true) {
             $this->dispatch(new SendNewMessageEmail($m, $request->user(), $receiver));
         }
         return redirect()->route('messages.show', $receiver->username)->with('message', "Message Sent!");
     }
     return back()->with('error', "Error! Something not well.");
 }