コード例 #1
0
ファイル: SendEmail.php プロジェクト: enspdf/billr
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     // grab the user
     $user = User::find($this->user_id);
     // grab the bill
     $bill = Bill::find($this->bill_id);
     // check the user hasn't been disabled
     if (empty($user)) {
         return false;
     }
     // validate that the user has an email
     if (empty($user['email'])) {
         return false;
     }
     // setup the default template
     $template = 'emails.email.notification';
     // setup the default subject
     $subject = 'Upcoming Bill - ' . $bill->company['name'] . ' (' . $bill['amount'] . ') on ' . date('F d, Y', strtotime($bill['due']));
     // check to see if this bill is over due
     if ($this->isOverDue) {
         $template = 'emails.email.notification_overdue';
         $subject = 'Overdue Bill - ' . $bill->company['name'] . ' (' . $bill['amount'] . ') on ' . date('F d, Y', strtotime($bill['due'])) . '!';
     }
     // Try to send an Email
     Mail::send($template, ['bill' => $bill], function ($message) use($user, $subject) {
         $message->from('*****@*****.**', 'MyBillr Notification');
         $message->subject($subject);
         $message->to($user['email']);
     });
 }
コード例 #2
0
ファイル: Bill.php プロジェクト: enspdf/billr
 /**
  * loads the bill handling the authentication
  * @param  integer $id bill id
  * @return bill    bill array
  */
 public static function loadBill($id)
 {
     $bill = array();
     $bill = Bill::find($id);
     if (!empty($bill)) {
         if (Auth::id() != $bill['user_id']) {
             return array();
         }
     }
     return $bill;
 }
コード例 #3
0
ファイル: SendSMS.php プロジェクト: enspdf/billr
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     $user = User::find($this->user_id);
     $bill = Bill::find($this->bill_id);
     $template = 'emails.sms.notification';
     if ($this->isOverDue) {
         $template = 'emails.sms.notification_overdue';
     }
     if (empty($user)) {
         return false;
     }
     // validate
     if (empty($user['phone_number']) || empty($user['phone_provider'])) {
         return false;
     }
     // Try to send a SMS
     Mail::send($template, ['bill' => $bill], function ($message) use($user) {
         $message->from('*****@*****.**', 'MyBillr Notification');
         //$message->subject('Upcoming Bill');
         $message->to($user['phone_number'] . $user['phone_provider']);
     });
 }
コード例 #4
0
ファイル: BillController.php プロジェクト: bll44/billcalc
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     return Bill::find($id)->residence;
 }
コード例 #5
0
ファイル: BillsController.php プロジェクト: mchampaneri/bilz
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $bill = Bill::find($id);
     if ($bill->delete()) {
         return "Bill with Bill no" . $id . "was removed";
     }
     return " Something happend wrong during deletion of the bill no" . $id;
 }
コード例 #6
0
 public function DelBill(Request $request, $billID)
 {
     if ($request->ajax()) {
         $bill = Bill::find($billID);
         $bill->delete();
     }
 }
コード例 #7
0
 public function BillDetail($bill_id)
 {
     if (Auth::check()) {
         $billInfo = Bill::find($bill_id);
         if ($billInfo->customer_id == Auth::user()->id) {
             $customerInfo = CustomerInfo::getAddressInfo($billInfo->customer_info_id);
             $billDetail = billDetail::getProducts($bill_id);
             return view("pages.finish_purchase", compact("billInfo", "customerInfo", "billDetail"));
         } else {
             return redirect()->route("home");
         }
     } else {
         return redirect()->route("login");
     }
 }
コード例 #8
0
ファイル: Bills.php プロジェクト: bitller/nova
 /**
  * @param int $billId
  * @return array
  */
 private function getApplicationProductIds($billId)
 {
     $bill = Bill::find($billId);
     if (!$bill) {
         return [];
     }
     $applicationProductIds = [];
     $applicationProducts = $bill->applicationProducts()->select('product_id as id')->get();
     foreach ($applicationProducts as $applicationProduct) {
         $applicationProductIds[] = $applicationProduct->id;
     }
     return $applicationProductIds;
 }
コード例 #9
0
 public function generatePDF($id)
 {
     $input = array();
     $invoice = Bill::find($id);
     $input['invoice'] = $invoice;
     $input['id'] = $id;
     $company = Company::find($invoice->id);
     //$invoiceData = DB::table("invoice_detail")->where("invoice_id",$id);
     define('BUDGETS_DIR', './invoicexlxs/');
     // I define this in a constants.php file
     $pdfPath = "";
     if (!is_dir(BUDGETS_DIR)) {
         mkdir(BUDGETS_DIR, 0755, true);
     }
     $outputName = $fileurl = "RJLEX_" . strtoupper(substr($company->name, 0, 3)) . "_" . date("Y-M-d") . "_" . time() . ".pdf";
     // str_random is a [Laravel helper](http://laravel.com/docs/helpers#strings)
     $pdfPath = BUDGETS_DIR . '/' . $outputName;
     $invoice->pdf_url = $outputName;
     $invoice->update();
     // File::put($pdfPath, PDF::loadView($pdf, 'A4', 'portrait')->output());
     $pdf = PDF::loadView('invoicing.invoicepdf', $input)->setPaper('a4')->setOrientation('landscape')->save($pdfPath);
 }