mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange.git
synced 2026-08-19 04:14:04 +00:00
send email to notify customer about china bankslip and instruction to upload po
This commit is contained in:
@@ -100,19 +100,6 @@ class Booking extends Model
|
||||
return $this->hasOne(Invoice::class);
|
||||
}
|
||||
|
||||
public static function boot() {
|
||||
parent::boot();
|
||||
self::deleting(function($booking) {
|
||||
$booking->userBankSlip()->delete();
|
||||
$booking->supplierBooking()->delete();
|
||||
$booking->chinaBankSlip()->each(function($bankslip) {
|
||||
$bankslip->delete();
|
||||
});
|
||||
$booking->purchaseOrder()->delete();
|
||||
$booking->invoice()->delete();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Notifications;
|
||||
|
||||
use App\Booking;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
|
||||
class UploadPo extends Notification
|
||||
{
|
||||
|
||||
/** @var Booking */
|
||||
private $booking;
|
||||
|
||||
/**
|
||||
* UploadPo constructor.
|
||||
* @param Booking $booking
|
||||
*/
|
||||
public function __construct(Booking $booking)
|
||||
{
|
||||
$this->booking = $booking;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Build the mail representation of the notification.
|
||||
*
|
||||
* @param mixed $notifiable
|
||||
* @return \Illuminate\Notifications\Messages\MailMessage
|
||||
*/
|
||||
public function toMail($notifiable)
|
||||
{
|
||||
$message = new MailMessage;
|
||||
$message->line('您好, 订单号 : '.$this->booking->id.' 的人民币汇款已成功。 请在这个网址 http://exchange.cief-malaysia.com/ 登录您的账号,并点击以下按钮,上载PO到系统. 谢谢.')
|
||||
->line('The payment to your supplier for the order no: '.$this->booking->id.' has been successful, please login to your account at http://exchange.cief-malaysia.com/ and then click on the button below upload your order\'s po');
|
||||
foreach ($this->booking->chinaBankSlip as $bankslip){
|
||||
$message->attach(Storage::disk('public')->url($bankslip->china_bank_slip_path));
|
||||
}
|
||||
return $message;
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,13 @@ Route::get('/', 'WelcomeController@index');
|
||||
Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.request');
|
||||
Route::post('password/reset', 'Auth\ResetPasswordController@postReset')->name('password.reset');
|
||||
|
||||
Route::get('mail', function () {
|
||||
$booking = App\Invoice::find(9323);
|
||||
|
||||
return (new App\Notifications\UploadPo($booking))
|
||||
->toMail($booking->user);
|
||||
});
|
||||
|
||||
Route::get('/po-approval', function(){
|
||||
$approvedInvoices = InvoiceStatuses::where(function($q) {
|
||||
$q->where('status', 'approve')
|
||||
|
||||
Reference in New Issue
Block a user