34 lines
772 B
PHP
34 lines
772 B
PHP
<?php
|
|
|
|
namespace App\Notifications;
|
|
|
|
use Illuminate\Bus\Queueable;
|
|
use Illuminate\Notifications\Messages\MailMessage;
|
|
use Illuminate\Notifications\Notification;
|
|
use App\Models\Kopi;
|
|
|
|
class LowStockNotification extends Notification
|
|
{
|
|
use Queueable;
|
|
|
|
protected $coffee;
|
|
|
|
public function __construct(Kopi $coffee)
|
|
{
|
|
$this->coffee = $coffee;
|
|
}
|
|
|
|
public function via($notifiable)
|
|
{
|
|
return ['mail'];
|
|
}
|
|
|
|
public function toMail($notifiable)
|
|
{
|
|
return (new MailMessage)
|
|
->line('The stock for coffee ' . $this->coffee->nama_kopi . ' is low.')
|
|
->action('View Coffee', url('/kopis/' . $this->coffee->id))
|
|
->line('Current stock: ' . $this->coffee->stok);
|
|
}
|
|
}
|