<?php
namespace Portal\Mileage\Events;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
use Portal\Mileage\Model\MainApp;
use Portal\Mileage\Model\ContentEmail;

class NotifyEmailAction extends Mailable
{
    use Queueable, SerializesModels;

    public $data;
    public $id;

    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct($data,$id)
    {
        $this->data = MainApp::whereIn('id',$data)
        ->with('leavetype','user','lkpstatus','appleave.leavedate','appleave.leavecode')
        ->with('cancelleave.canceldate','user','lkpstatus','user.info','verifier','approver','cancelleave.canceldt')
        ->get();

        $this->id = $id;

        // echo $this->data;
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        // $content = ContentEmail::where('id',$this->id)->first();

        if($this->id == 12){

             return $this
            ->subject('Senarai Permohonan Cuti Pegawai Untuk Tindakan Sokongan')
            ->cc('pss3frsb@gmail.com')
            ->markdown('ecuti::admin.sentmail.verifylist');
        }

        if($this->id == 13){

             return $this
            ->subject('Senarai Permohonan Cuti Pegawai Untuk Tindakan Kelulusan')
            ->cc('pss3frsb@gmail.com')
            ->markdown('ecuti::admin.sentmail.approvallist');
        }
        

       
    }
}