<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use App\Http\Controllers\MailController;
use App\Invitation;
use App\Notifications;
use App\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Support\Facades\DB;


class NotificationsMailController extends Controller
{

    public function sendNotificationMail(){
        $notifications = Notifications::where('is_read','=',0)
            ->where('is_archived','=',0)
            ->where('type','<>','TaskInactive')
            ->distinct()->get(['user_to']);
//        foreach ($notifications as $notification){
//            $random_string = md5(microtime());
//            $user = User::find($notification->user_to);
//            if ($user->isApplicant()) {
//                (new MailController)->sendMailNotifications($random_string, $notification->user->email);
//            }

//        }
        $random_string = md5(microtime());
        (new MailController)->sendMailNotifications($random_string, 'webmaster@untref.edu.ar');
    }


}

