Example #1
0
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     if (method_exists($this, 'customizeSpark')) {
         $this->customizeSpark();
     }
     if (method_exists($this, 'customizeRegistration')) {
         $this->customizeRegistration();
     }
     if (method_exists($this, 'customizeRoles')) {
         $this->customizeRoles();
     }
     if (method_exists($this, 'customizeProfileUpdates')) {
         $this->customizeProfileUpdates();
     }
     if (method_exists($this, 'customizeSubscriptionPlans')) {
         $this->customizeSubscriptionPlans();
     }
     if (method_exists($this, 'customizeSettingsTabs')) {
         $this->customizeSettingsTabs();
     }
     if ($this->twoFactorAuth) {
         Spark::withTwoFactorAuth();
     }
     Spark::generateInvoicesWith($this->invoiceWith);
 }
Example #2
0
 /**
  * Notify the given user about a new invoice.
  *
  * @param  \Illuminate\Contracts\Auth\Authenticatable  $user
  * @param  \Laravel\Cashier\Invoice  $invoice
  * @return void
  */
 public function notify(Authenticatable $user, Invoice $invoice)
 {
     $invoiceData = array_merge(['vendor' => 'Vendor', 'product' => 'Product', 'vat' => new ViewExpression(nl2br(e($user->extra_billing_info)))], Spark::generateInvoicesWith());
     $data = compact('user', 'invoice', 'invoiceData');
     Mail::send('spark::emails.billing.invoice', $data, function ($message) use($user, $invoice, $invoiceData) {
         $message->to($user->email, $user->name)->subject('Your ' . $invoiceData['product'] . ' Invoice')->attachData($invoice->pdf($invoiceData), 'invoice.pdf');
     });
 }
Example #3
0
 /**
  * Download the given invoice for the user.
  *
  * @param  string  $invoiceId
  * @return \Illuminate\Http\Response
  */
 public function downloadInvoice(Request $request, $invoiceId)
 {
     $data = array_merge(['vendor' => 'Vendor', 'product' => 'Product', 'vat' => new ViewExpression(nl2br(e($request->user()->extra_billing_info)))], Spark::generateInvoicesWith());
     return Auth::user()->downloadInvoice($invoiceId, $data);
 }