<?php

namespace App\Http\Controllers\v1;

use Illuminate\Http\Request;
use Validator;
use App\Employee;

class OneSignalController extends Controller
{

	public function send(Request $request, $id)
    {
		
        $employee = Employee::find($id);
		
		if ($employee) {
			
			$params = array(
				'contents' => array('en' => $request->message),
				'headings' =>  array('en' => 'HERE'),
				'subheadings' =>  array('en' => 'HERE 2'),
				'include_player_ids' => [$employee->one_signal_push_id],
				'data' => array(
					'view_url' => 'http://www.uol.com.br'
				)
			);
			
			\OneSignal::sendNotificationCustom($params);		
		}

    }

}
