master
Uğur Arıcı 5 years ago
commit 67cc77ddf6
  1. 3
      app/Http/Controllers/DonationController.php
  2. 34
      app/Mail/SuccessfulPayment.php
  3. 15
      resources/views/emails/successfulpayment.blade.php

@ -8,6 +8,7 @@ use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
use App\Mail\UserCreated;
use App\Mail\SuccessfulPayment;
use Illuminate\Support\Facades\Mail;
class DonationController extends Controller
@ -167,7 +168,7 @@ class DonationController extends Controller
}
$donation->save();
Mail::to($donation)->send(new SuccessfulPayment($donation));
return redirect()->route('donation.success', $donation->conversation_id);
}

@ -0,0 +1,34 @@
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use App\Donation;
class SuccessfulPayment extends Mailable
{
use Queueable, SerializesModels;
public $donation;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct(Donation $donation)
{
$this->donation = $donation;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->subject("Thank you for your donation!")->markdown('emails.successfulpayment');
}
}

@ -0,0 +1,15 @@
@component('mail::message')
# Thank you for your donation!
We received your {{$donation->amount}} {{$donation->currency}} USD donation.
Name: {{$donation->first_name}} {{$donation->last_name}}
Amount: {{$donation->amount}} {{$donation->currency}}
Transaction Date: {{$donation->created_at}}
Next Payment Date: {{$donation->next_payment_at}}
@endcomponent
Loading…
Cancel
Save