<?php

namespace App\Notifications;

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

class FileUploadedNotification extends Notification implements ShouldQueue
{
    use Queueable;

    protected $file;
    protected $folder;
    protected $by;

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

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

    public function toDatabase($notifiable)
    {
        return [
            'title' => 'File Uploaded',
            'body' => $this->by . ' uploaded file "' . $this->file->name . '" to folder "' . $this->folder->name . '".',
            'file_id' => $this->file->id,
            'folder_id' => $this->folder->id,
            'by' => $this->by,
        ];
    }
}
