finish implementing mails
This commit is contained in:
@@ -3,10 +3,13 @@
|
||||
namespace App\Repositories\Shop;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use App\Mail\Acheminement;
|
||||
use App\Mail\Preparation;
|
||||
use App\Models\Shop\Order;
|
||||
use App\Repositories\Core\DateStats;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
class Orders
|
||||
{
|
||||
@@ -34,6 +37,35 @@ class Orders
|
||||
return ($order && $detail) ? Invoices::saveInvoice($order->id, $data) : false;
|
||||
}
|
||||
|
||||
public static function testSend($id)
|
||||
{
|
||||
$order = self::get($id, ['customer', 'address']);
|
||||
dump($order->toArray());
|
||||
exit;
|
||||
self::sendPreparation($order);
|
||||
}
|
||||
|
||||
public static function sendOrderConfirmed($order_id)
|
||||
{
|
||||
$order = self::get($order_id, ['customer']);
|
||||
$mail = new Acheminement($order);
|
||||
return Mail::to($order->email)->send($mail);
|
||||
}
|
||||
|
||||
public static function sendShipping($order_id)
|
||||
{
|
||||
$order = self::get($order_id, ['customer']);
|
||||
$mail = new Acheminement($order);
|
||||
return Mail::to($order->email)->send($mail);
|
||||
}
|
||||
|
||||
public static function sendPreparation($order_id)
|
||||
{
|
||||
$order = self::get($order_id, ['customer']);
|
||||
$mail = new Preparation($order);
|
||||
return Mail::to($order->email)->send($mail);
|
||||
}
|
||||
|
||||
public static function count()
|
||||
{
|
||||
return Order::count();
|
||||
|
||||
Reference in New Issue
Block a user