<?php

namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;

class ApprovalRequiredNotification extends Notification implements ShouldQueue
{
    use Queueable;

    protected $item;
    protected $by;

    public function __construct($item, $by)
    {
        $this->item = $item;
        $this->by = $by;
    }

    public function via($notifiable)
    {
        return ['database'];
    }

    public function toDatabase($notifiable)
    {
        return [
            'title' => 'Approval or Review Required',
            'body' => $this->by . ' requested your approval/review for "' . $this->item->name . '".',
            'item_id' => $this->item->id,
            'by' => $this->by,
        ];
    }
}
